Skip to content

ValentinB01/RAG_technical_documents_analyzer

Repository files navigation

📖 RAG Tech Docs

Retrieval-Augmented Generation system for technical documentation, powered by local models.

Question → [Semantic Search] → [Relevant Chunks] → [LLM Generation] → Answer with Sources

Architecture

┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│  Documents   │────▶│   Chunking   │────▶│   ChromaDB   │
│ .md .txt .pdf│     │  256 tokens  │     │  Vector Store │
└──────────────┘     └──────────────┘     └──────┬───────┘
                                                  │
┌──────────────┐     ┌──────────────┐     ┌──────▼───────┐
│   Answer +   │◀────│  Phi-3 LLM   │◀────│  Retriever   │
│   Sources    │     │   (Ollama)   │     │  Top-K Search │
└──────────────┘     └──────────────┘     └──────────────┘

Tech Stack

Component Technology
Embeddings all-MiniLM-L6-v2 (sentence-transformers)
Vector DB ChromaDB (persistent, local)
LLM Phi-3 via Ollama
Backend FastAPI
Frontend Gradio

Quick Start

1. Prerequisites

  • Python 3.10+
  • Ollama installed with Phi-3: ollama pull phi3

2. Install dependencies

cd rag_tech_docs
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

3. Add documents

Place .md, .txt, or .pdf files in the docs/ folder. Sample docs are included.

4. Index documents

python ingest.py

5. Run the server

python api.py

API Endpoints

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

Example query

curl -X POST http://localhost:8000/query \
  -H "Content-Type: application/json" \
  -d '{"question": "How do I install FastAPI?", "top_k": 3}'

Project Structure

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

alt text

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages