Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

🔎 Codebase RAG Assistant

Ask questions about a codebase in plain English. The assistant finds the most relevant code with semantic search, then has a local LLM answer using that code as context.

Python Streamlit FAISS Ollama

How it works

data/*.py ──► chunk (500 chars) ──► embed (all-MiniLM-L6-v2) ──► FAISS index
                                                                     │
question ──► embed ──► top-k nearest chunks ──► llama3.2 (Ollama) ──► answer + sources
  1. Ingest: ingest.py splits every .py file in data/ into chunks, embeds them and saves index.faiss + chunks.pkl.
  2. Retrieve: search.py embeds your question and pulls the closest chunks from the index.
  3. Answer: the chunks and your question go to a local llama3.2 model, which answers from the code (or says it doesn't know).

Everything runs locally. No API keys needed.

Quick start

Prerequisites: Python 3.10+ and Ollama installed.

# 1. Install dependencies
pip install streamlit faiss-cpu sentence-transformers requests

# 2. Pull the model and start Ollama
ollama pull llama3.2
ollama serve

# 3. Build the index from the files in data/
python ingest.py

# 4. Launch the app
streamlit run app.py

To query your own code, drop .py files into data/ and re-run python ingest.py.

Features

  • 💬 Chat interface with conversation history
  • 🎚️ Adjustable number of retrieved sources (1–10)
  • 📚 Retrieved code shown under each answer with filename, match distance and syntax highlighting
  • ⚡ One-click example questions to get started
  • 🖥️ CLI mode: python search.py

Project structure

File Purpose
app.py Streamlit chat UI
search.py Semantic search + LLM call (also runnable as a CLI)
ingest.py Chunks, embeds and indexes files in data/
encode_example.py Small demo of embedding similarity
data/ Sample codebase to query

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages