Retrieval-Augmented Generation system for technical documentation, powered by local models.
Question → [Semantic Search] → [Relevant Chunks] → [LLM Generation] → Answer with Sources
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Documents │────▶│ Chunking │────▶│ ChromaDB │
│ .md .txt .pdf│ │ 256 tokens │ │ Vector Store │
└──────────────┘ └──────────────┘ └──────┬───────┘
│
┌──────────────┐ ┌──────────────┐ ┌──────▼───────┐
│ Answer + │◀────│ Phi-3 LLM │◀────│ Retriever │
│ Sources │ │ (Ollama) │ │ Top-K Search │
└──────────────┘ └──────────────┘ └──────────────┘
| Component | Technology |
|---|---|
| Embeddings | all-MiniLM-L6-v2 (sentence-transformers) |
| Vector DB | ChromaDB (persistent, local) |
| LLM | Phi-3 via Ollama |
| Backend | FastAPI |
| Frontend | Gradio |
- Python 3.10+
- Ollama installed with Phi-3:
ollama pull phi3
cd rag_tech_docs
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtPlace .md, .txt, or .pdf files in the docs/ folder. Sample docs are included.
python ingest.pypython api.py- Chat UI: http://localhost:8000/chat
- API docs: http://localhost:8000/docs
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Health check |
POST |
/query |
Query the RAG pipeline |
POST |
/ingest |
Re-index all documents |
POST |
/upload |
Upload a new document |
curl -X POST http://localhost:8000/query \
-H "Content-Type: application/json" \
-d '{"question": "How do I install FastAPI?", "top_k": 3}'rag_tech_docs/
├── config.py # Configurare centralizată
├── ingest.py # Document ingestion pipeline
├── retriever.py # Semantic search engine
├── generator.py # LLM generation (Ollama/Phi-3)
├── rag.py # RAG pipeline (retriever + generator)
├── api.py # FastAPI + Gradio server
├── docs/ # Documentele de indexat
│ ├── fastapi_guide.md
│ └── python_tips.md
├── chroma_db/ # Vector database (auto-generated)
├── requirements.txt
└── README.md
