A production-grade RAG system combining dense vector search and sparse keyword retrieval for deep code understanding.
- Hybrid Retrieval: Combines Qdrant (Vector) and Redis (Keyword/BM25) with RRF fusion.
- Deep Indexing: AST-based parsing for chunking of Go code.
- Hierarchical Context: Understanding from file to function level.
- LLM Integration: Works seamlessly with local Ollama models.
- Automated Docs: Swagger/OpenAPI documentation auto-generated.
The system uses a hybrid deployment model for the best local development experience:
- Infrastructure: Qdrant and Redis run in Docker containers (via Docker Compose).
- Application: The Go server runs natively on your host for full filesystem access.
- Go 1.22+
- Docker & Docker Compose
- Ollama running locally
-
Start Infrastructure (Qdrant & Redis)
docker-compose up -d
-
Build Server
go build -o rag-server cmd/rag-server/main.go
-
Run Server
./rag-server
The API will be available at
http://localhost:8080.
You can index any folder on your local machine.
curl -X POST http://localhost:8080/api/index \
-H "Content-Type: application/json" \
-d '{"path": "/Users/guru/projects/my-app"}'Ask natural language questions about your code.
curl -X POST http://localhost:8080/api/query \
-H "Content-Type: application/json" \
-d '{
"query": "How is authentication handled?",
"max_results": 5
}'Swagger UI is available at:
http://localhost:8080/swagger/index.html
Regenerate docs:
swag init -g cmd/rag-server/main.goConfiguration is managed via .env file.
# Ollama
OLLAMA_URL=http://localhost:11434
EMBEDDING_MODEL=all-minilm
LLM_MODEL=llama3.2:1b
# Databases
VECTOR_STORE_URL=http://localhost:6333
REDIS_URL=localhost:6379
# Hybrid Search Tuning
HYBRID_ENABLED=true
HYBRID_VECTOR_WEIGHT=0.7
FUSION_STRATEGY=rrf├── cmd/rag-server/ # Application entrypoint
├── internal/
│ ├── api/ # HTTP handlers & middleware
│ ├── indexing/ # AST parsing & chunking logic
│ ├── retrieval/ # Hybrid search & ranking engine
│ ├── vectorstore/ # Qdrant integration
│ └── domain/ # Core data models
├── docs/ # Generated Swagger docs
└── docker-compose.yml # Infrastructure orchestration