How beshoy1612/multi_model_rag works
Multi_Model_RAG is a FastAPI retrieval-augmented generation service. Its apparent workflow accepts project files, extracts and chunks document content, stores project/chunk records, indexes chunks for semantic and keyword retrieval, then combines and reranks search results. The sampled NLP controller implements hybrid search; generation and image-analysis interfaces exist, but their use in a user-facing answer flow is not shown. Route-to-controller execution and some ingestion/storage connections are not visible in the excerpts, so those links are omitted or marked unverified.
Main entry points: main.py FastAPI app · Routes API routes · NLP_Controller.py Hybrid search · Chunk_model.py Chunk records
Components 20
API and orchestration
- FastAPI app
Src/main.py - API routes
Src/Routes - NLP endpoints
Src/Routes/NLP.py
Project and ingestion
- Upload validation
Src/Controllers/Data_controller.py - Document processing
Src/Controllers/Process_Controller.py - Project files
Src/Controllers/Project_Controller.py
Hybrid retrieval
- Hybrid search
Src/Controllers/NLP_Controller.py
Provider integrations
- LLM factory
Src/stores/LLM/LLMProviderFactory.py - Cohere / Gemini
Src/stores/LLM/Providers - LLM interface
Src/stores/LLM/LLMinterface.py - Vector DB factory
Src/stores/Vectordb/Vectordb_Provider_Factory.py - Qdrant adapter
Src/stores/Vectordb/Providers/Qdrantdb.py - Keyword factory
Src/stores/LLM/KeywordSearch/KeywordSearch_Provider_Factory.py - BM25 search
Src/stores/LLM/KeywordSearch/Provider/BM25Provider.py
Persistence
- Chunk records
Src/models/Chunk_model.py - Project records
Src/models/Project_model.py - Asset records
Src/models/Asset_model.py - ORM schemas
Src/models/db_schemes/schemes - PostgreSQL
Other components
- API client
Connections 27
- API client → FastAPI app: sends requests
- FastAPI app → API routes: registers routes
Src/main.py - API routes → Upload validation: uses upload logic
Src/Routes/data.py - API routes → Document processing: uses processing
Src/Routes/data.py - API routes → Project records: references projects
Src/Routes/NLP.py - API routes → Asset records: references assets
Src/Routes/data.py - NLP endpoints → Hybrid search: uses search logic
Src/Routes/NLP.py - FastAPI app → NLP endpoints: registers router
Src/main.py - Document processing → Project files: resolves file path
Src/Controllers/Process_Controller.py - Hybrid search → Chunk records: loads ranked chunks
Src/Controllers/NLP_Controller.py - Hybrid search → LLM factory: uses embedding client
- Hybrid search → Vector DB factory: uses vector client
- Hybrid search → Keyword factory: uses keyword client
- FastAPI app → Chunk records: creates model
Src/main.py - FastAPI app → LLM factory: creates providers
Src/main.py - FastAPI app → Vector DB factory: creates provider
Src/main.py - FastAPI app → Keyword factory: creates provider
Src/main.py - LLM factory → Cohere / Gemini: selects provider
Src/stores/LLM/LLMProviderFactory.py - Cohere / Gemini → LLM interface: implements contract
Src/stores/LLM/Providers/CohereProvider.py - Vector DB factory → Qdrant adapter: selects adapter
Src/stores/Vectordb/Vectordb_Provider_Factory.py - Keyword factory → BM25 search: selects provider
Src/stores/LLM/KeywordSearch/KeywordSearch_Provider_Factory.py - Chunk records → ORM schemas: queries chunks
Src/models/Chunk_model.py - Project records → ORM schemas: uses project schema
Src/models/Project_model.py - Asset records → ORM schemas: uses asset schema
Src/models/Asset_model.py - Chunk records → PostgreSQL: reads and writes
- Project records → PostgreSQL: reads and writes
- Asset records → PostgreSQL: reads and writes