Codebase Q&A with Context-Aware RAG
Oxeye is an intelligent code assistant that answers questions about your codebase using Retrieval-Augmented Generation (RAG). It parses code into semantic chunks, understands relationships, and provides accurate answers with file references.
| Feature | Description |
|---|---|
| 🌳 AST Parsing | Uses Tree-sitter for accurate code parsing across languages |
| � Semantic Chunking | Preserves function/class boundaries instead of arbitrary splits |
| � Hybrid Search | Combines dense (embedding) + sparse (BM25) retrieval |
| ⚡ Cross-Encoder Reranking | Improves precision with contextual re-scoring |
| 🤖 Free LLM | Uses Groq's free API (Llama 3.3 70B) - no cost! |
| 💬 Streaming Chat | Real-time responses with file citations |
| 🐙 GitHub Support | Clone and index repos directly from URL |
| 🎨 Modern UI | Dark theme with glassmorphism effects |
git clone https://github.com/yourusername/oxeye.git
cd oxeye
# Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txtGet a free Groq API key at console.groq.com
# Copy the example config
copy .env.example .env
# Edit .env and add your key
GROQ_API_KEY=your_api_key_herestreamlit run oxeye/ui/streamlit_app.pyOpen http://localhost:8502 and start asking questions!
oxeye/
├── oxeye/
│ ├── __init__.py # Package init
│ ├── config.py # Settings management
│ │
│ ├── core/
│ │ ├── parser/
│ │ │ ├── ast_parser.py # Tree-sitter AST parsing
│ │ │ └── chunker.py # Semantic code chunking
│ │ │
│ │ ├── embeddings/
│ │ │ └── encoder.py # Sentence-transformers embeddings
│ │ │
│ │ ├── retrieval/
│ │ │ ├── hybrid.py # Dense + BM25 fusion
│ │ │ ├── reranker.py # Cross-encoder reranking
│ │ │ └── context.py # Context builder for LLM
│ │ │
│ │ └── llm/
│ │ ├── client.py # Groq API client
│ │ └── chains.py # RAG chain orchestration
│ │
│ ├── ingestion/
│ │ ├── crawler.py # File discovery
│ │ └── pipeline.py # End-to-end ingestion
│ │
│ ├── storage/
│ │ └── vector_store.py # FAISS vector storage
│ │
│ └── ui/
│ └── streamlit_app.py # Chat interface
│
├── requirements.txt # Dependencies
├── pyproject.toml # Package config
├── .env.example # Environment template
└── README.md
graph LR
A[📂 Codebase] --> B[🌳 AST Parser]
B --> C[🧩 Chunker]
C --> D[🔢 Embedder]
D --> E[(💾 FAISS)]
F[❓ Question] --> G[🔍 Hybrid Search]
E --> G
G --> H[⚡ Reranker]
H --> I[📝 Context Builder]
I --> J[🤖 LLM]
J --> K[💬 Answer]
- Crawl - Find source files (Python, JS, etc.)
- Parse - Extract functions, classes, docstrings via AST
- Chunk - Split into semantic units preserving context
- Embed - Generate vectors via sentence-transformers (local)
- Store - Save to FAISS for fast similarity search
- Search - Combine dense + BM25 with RRF fusion
- Rerank - Boost precision with cross-encoder
- Generate - Stream answer from Groq LLM
All settings in .env:
| Variable | Default | Description |
|---|---|---|
GROQ_API_KEY |
Required | Your Groq API key |
LLM_MODEL |
llama-3.3-70b-versatile |
Groq model to use |
EMBEDDING_MODEL |
all-MiniLM-L6-v2 |
Local embedding model |
TOP_K_RETRIEVAL |
10 |
Chunks to retrieve |
TOP_K_RERANK |
5 |
Chunks after reranking |
GITHUB_TOKEN |
Optional | For private repos |
| Component | Technology |
|---|---|
| LLM | Groq (Llama 3.3 70B) |
| Embeddings | sentence-transformers (local) |
| Vector Store | FAISS |
| AST Parsing | Tree-sitter |
| Sparse Search | BM25 (rank-bm25) |
| Reranking | Cross-encoders |
| UI | Streamlit |
| Config | Pydantic Settings |
from oxeye.ingestion.pipeline import IngestionPipeline
pipeline = IngestionPipeline(collection_name="my_project")
stats = pipeline.ingest("./path/to/codebase")
print(f"Indexed {stats.chunks_created} chunks")from oxeye.core.llm.chains import RAGChain
chain = RAGChain(collection_name="my_project")
answer = chain.ask("How does authentication work?")
print(answer)for chunk in chain.stream("Explain the database models"):
print(chunk, end="", flush=True)- ✅ Be specific - "How does UserService.create_user validate email?" works better than "how does it work?"
- ✅ Reference files - "What does auth.py do?" helps narrow context
- ✅ Ask about patterns - "What design patterns are used in the API layer?"
- ✅ Debug with context - "Why might login fail in auth_controller.py?"
Contributions welcome! Feel free to:
- Fork the repository
- Create a feature branch
- Submit a pull request
MIT License - see LICENSE for details.
Made with ❤️ by Shaan