How kolhesamiksha/hybrid-search-rag works
Key Components to Include in the System Design:
Frontend Layer
• Streamlit App (chat_streamlit_app)
• FastAPI Swagger UI
• User interaction flows
API Layer
• FastAPI Backend (chat_restapi)
• Main endpoints (/predict)
• Rate limiting component (router/limiter.py)
Core RAG Pipeline (hybrid_rag)
a. Query Processing:
• Query Expansion
• Self-Query Retriever
• Metadata Filtering
b. Search Components:
• Hybrid Search (combining sparse and dense embeddings)
• Reranker
• Vector Store (Milvus)
c. LLM Integration:
• GPT-4 Model
• Prompt Management
• Guard Rails
Data Storage
• MongoDB (for API secrets and metadata)
• Zilliz Milvus Vector Store (for embeddings)
• Chat History Storage
External Services
• AI/ML API Integration
• Embedding Models:
• Qdrant/bm42-all-minilm-l6-v2-attentions (Sparse)
• jinaai/jina-embeddings-v2-base-en (Dense)
• User Interface (Top)
• API Layer (Upper Middle)
• RAG Pipeline (Middle)
• Storage Layer (Bottom)
• External Services (Right Side)
Specific Flows
1. User Query Flow:
User → Streamlit → FastAPI → Query Processing → Hybrid Search → LLM → Response
2. Document Processing Flow:
Web Crawling → Semantic Chunking → Embedding Generation → Vector Storage
3. Retrieval Flow:
Query → Hybrid Search (Sparse + Dense) → Reranking → Context Selection → LLM
Additional Elements
• Metrics and limits (e.g., context window sizes)
• Security boundaries
• Deployment environments
Technical Details to Highlight
• Embedding dimensions
• Chunk sizes
• Rate limits
• API endpoints
• Storage capacities
Performance Optimization Points
• Where caching occurs
• Parallel processing
• Reranking checkpoints
Remember to:
• Keep components proportional to their importance
• Use clear, readable labels
• Version numbers for key components
• Both synchronous and asynchronous paths
• Error handling paths
• Monitoring and logging points