AI-powered semantic search API built with FastAPI, OpenAI Embeddings, and ChromaDB.
This project demonstrates the core concepts behind:
- Embeddings
- Semantic Search
- Similarity Search
- Vector Databases
- RAG (Retrieval-Augmented Generation)
- Store documents with embeddings
- Semantic similarity search
- Vector database integration
- Metadata filtering
- FastAPI REST API
- ChromaDB persistent storage
| Technology | Purpose |
|---|---|
| FastAPI | Backend API |
| OpenAI Embeddings | Semantic vector generation |
| ChromaDB | Vector database |
| Python | Core language |
app/
├── main.py
├── config.py
├── schemas.py
│
├── services/
│ ├── embedding_service.py
│ └── vector_store.pygit clone https://github.com/your-username/ai-semantic-search-api.gitcd ai-semantic-search-apipython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtCreate .env file:
OPENAI_API_KEY=your_openai_api_keyuvicorn app.main:app --reloadOpen Swagger Docs:
http://127.0.0.1:8000/docs| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Health check |
| POST | /documents |
Add document |
| POST | /search |
Semantic search |
| GET | /documents |
List all documents |
| DELETE | /documents |
Delete all documents |
{
"title": "FastAPI Tutorial",
"content": "FastAPI is a modern Python framework for building APIs quickly.",
"category": "backend"
}{
"query": "How can I build API with Python?",
"limit": 3
}Query:
How can I build APIs with Python?Result:
FastAPI TutorialEven without exact keyword matching.
This works because embeddings capture semantic meaning.
This project helps practice:
- Embeddings
- Vector Search
- Similarity Search
- Cosine Similarity
- Semantic Retrieval
- Vector Databases
- RAG Foundations
- PDF Upload Support
- Text Chunking
- PostgreSQL + pgvector
- User Authentication
- AI Chatbot Integration
- RAG Pipeline
- Redis Caching
- Hybrid Search
This project is designed for developers learning:
- AI Engineering
- RAG Systems
- LLM Applications
- Vector Databases
- Semantic Search
MIT License