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