Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

title DevDocs AI
emoji 🤖
colorFrom blue
colorTo purple
sdk docker
app_port 7860
suggested_hardware cpu-basic
pinned false

DevDocs AI

A production-grade RAG system with hybrid search, cross-encoder reranking, and agentic routing — built entirely with free tools.

Live Demo Python 3.10 Groq ChromaDB MIT License


Overview

DevDocs AI answers questions about developer tools, frameworks, and libraries using a multi-stage retrieval pipeline. Instead of relying on a single embedding lookup, it combines dense semantic search, sparse BM25 keyword matching, and a cross-encoder reranker to surface the most relevant context before passing it to the LLM.

The entire stack runs on free-tier services — no paid APIs beyond optional monitoring.


How It Works

User Query
    │
    ▼
┌─────────────────────────────────────────────────────┐
│                    Query Router                      │
│  (LangGraph agent — routes to retrieve / search /   │
│   direct answer based on query classification)      │
└──────────────────────┬──────────────────────────────┘
                       │
           ┌───────────▼───────────┐
           │    Hybrid Retrieval   │
           │                       │
           │  Dense  ──┐           │
           │  (SBERT)  ├──► Merge ──► CrossEncoder ──► Top-K
           │  Sparse ──┘           │    Reranker
           │  (BM25)               │
           └───────────────────────┘
                       │
           ┌───────────▼───────────┐
           │     LLM Generation    │
           │  Groq / Llama 3.3 70B │
           └───────────────────────┘
                       │
              Answer + Sources + Scores

Stack

Layer Tool Notes
LLM Groq — Llama 3.3 70B Free tier, ~300 tok/s
Embeddings all-MiniLM-L6-v2 Local, no API cost
Vector DB ChromaDB Local persistent store
Sparse search BM25 (rank-bm25) In-memory, no server
Reranker ms-marco-MiniLM-L-6-v2 CrossEncoder, local
Orchestration LangChain + LangGraph Agent routing
UI Gradio 5 Deployed on HF Spaces
Deployment Docker on HF Spaces CPU-basic tier

Project Structure

devdocs-ai/
├── app.py                  # HF Spaces entry point
├── Dockerfile              # Container build (CPU-optimised)
├── requirements.txt
├── app/
│   └── gradio_app.py       # Gradio interface
└── src/
    ├── config.py           # Pydantic settings
    ├── agents/
    │   └── langgraph_agent.py   # SimpleRAG + RAGAgent
    ├── retrieval/
    │   └── hybrid_search.py     # Dense + BM25 + reranking
    ├── ingestion/
    │   ├── document_loader.py
    │   └── chunking.py
    └── evaluation/
        └── ragas_eval.py        # RAGAS metrics

Quick Start

Prerequisites

Run Locally

git clone https://github.com/vamsiy2001/DevDocs_AI-Intelligent_Documentation_Assistant.git
cd DevDocs_AI-Intelligent_Documentation_Assistant

python -m venv venv
source venv/bin/activate       # Windows: venv\Scripts\activate

pip install -r requirements.txt

# Add your key
echo "GROQ_API_KEY=your_key_here" > .env

python app.py
# Open http://localhost:7860

Run with Docker

docker build -t devdocs-ai .
docker run -p 7860:7860 -e GROQ_API_KEY=your_key_here devdocs-ai

Usage

from src.retrieval import HybridRetriever
from src.agents import SimpleRAG

retriever = HybridRetriever()
retriever.load_vector_store()   # or create_vector_store(docs)

rag = SimpleRAG(retriever)
result = rag.query("How do I use LangChain agents?")

print(result["answer"])
# Sources with relevance scores available in result["sources"]

Evaluation

Evaluated on 30 test cases using the RAGAS framework:

Metric Score Target
Context Precision 85% > 70%
Answer Faithfulness 92% > 80%
Context Recall 88% > 70%
Answer Relevancy 90% > 80%
P95 Latency 1.8s < 2s
# Run evaluation
python scripts/run_evaluation.py

Deployment

The live demo runs on HuggingFace Spaces (CPU basic, free tier).

The Docker image installs torch CPU-only (~200 MB) before other packages so that sentence-transformers does not pull the 2.6 GB CUDA wheel — keeping the build within memory limits.

To deploy your own copy:

git remote add space https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
git push space main

Set GROQ_API_KEY in Space Settings → Variables and secrets.


License

MIT — see LICENSE.

About

Production-grade RAG system with hybrid search, reranking, and comprehensive evaluation. Built with 100% free tools.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages