This project is currently in testing mode. It uses local hard disk files for storage (BM25 index, Qdrant data, and document state). This is not production-ready and is intended for local experimentation.
Adaptive RAG is a structure-aware retrieval-augmented generation (RAG) system that:
- Parses documents (PDF, DOCX, Markdown)
- Detects document structure and sections
- Chooses a retrieval strategy based on document structure and question type
- Retrieves via hybrid vector + keyword search
- Reranks results and generates answers using an LLM
- Ingestion: Upload a document to
/upload. The file is parsed and chunked. - Indexing: Chunks are stored in:
- Qdrant (local): Vector search index
- BM25 (local): Keyword search index
- Querying: Ask a question at
/ask. - Routing: Strategy is selected by document structure and question type.
- Retrieval + Rerank: Hybrid retrieval and cross-encoder reranking.
- Answering: LLM generates the final answer using retrieved context.
GET /- Health messageGET /health- Basic health checkPOST /upload- Upload and index a documentPOST /ask- Ask a question
These files and folders are created on disk during testing:
document_state.json- Document profile and sectionsbm25s_index.pkl- BM25 keyword indexqdrant_data/- Local Qdrant vector store
See requirements.txt for dependencies.
uvicorn app.main:app --reload- This build is not hardened for concurrent users.
- Indexing recreates the vector collection per upload.
- Use only for local testing until storage, concurrency, and security are improved.