This project is a modular LLM-powered service to answer questions based on documents.
app.py: FastAPI app entrypointconfig.py: Configuration and environment valuesmodels.py: Request and response schema modelstext_extraction.py: Document text extraction & chunkingretrieval.py: BM25 and FAISS retrieval logicembedding.py: Embedding model handlinganswer_generation.py: LLM answer generationutils.py: Helper functionstests/: Unit and integration tests
Install dependencies from requirements.txt and set environment variables for your API keys.
Create a .env file with:
GROQ_API_KEY=your_groq_api_key
GROQ_MODEL=llama-3.1-8b-instant
GEMINI_API_KEY=optional_for_gemini_ocr
Run the app with: uvicorn app:app --host 0.0.0.0 --port 8000 --workers 1
Run Streamlit frontend: streamlit run streamlit_app.py