Local GitHub RAG is a Streamlit application that helps developers understand codebases through natural language queries using local LLMs. It clones GitHub repositories locally and implements RAG (Retrieval Augmented Generation) to provide context-aware responses about your code.
- 🔍 Clone and analyze GitHub repositories locally
- 💬 Ask questions about the codebase in natural language
- 🤖 Powered by local LLMs through Ollama
- 📝 Optional GitHub issues integration
- 🗄️ Persistent vector storage for quick repository switching
- 🔄 Support for multiple repositories
- 🎯 Efficient code context retrieval using multi-query generation
- Python 3.8+
- Ollama installed locally
- Git
The following models need to be available through Ollama:
qwen2.5-coder:14bfor code understanding and response generationnomic-embed-textfor text embeddings
# Clone the repository
git clone git@github.com:pixelsoccupied/local-github-rag.git
cd local-github-rag
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On macOS/Linux
# Install dependencies
pip install -r requirements.txt
# Start the server
streamlit run main.py- Start the Streamlit application:
streamlit run app.py-
Choose one of three options:
- Process a new repository by entering a GitHub URL
- Use an already downloaded repository from the ./repos directory
- Switch to a previously processed repository
-
Optional: Include GitHub issues in the analysis by providing a GitHub token
-
Start asking questions about your codebase!
GITHUB_TOKEN(optional): For fetching GitHub issues and higher API rate limits
-
Repository Processing:
- Clones the GitHub repository locally
- Processes code files and optionally GitHub issues
- Splits content into chunks for efficient retrieval
- Creates embeddings using the nomic-embed-text model
- Stores vectors in a local Chroma database
-
Question Answering:
- Uses multi-query retrieval to find relevant code contexts
- Generates comprehensive responses using the Qwen coder model
- Provides specific code examples and issue references when applicable
- Python (.py)
- Markdown (.md)
- Text (.txt)
- Go (.go)
- JavaScript (.js)
- Java (.java)
- C++ (.cpp, .h)
- Rust (.rs)
- AsciiDoc (.adoc)
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License
- Built with Streamlit
- Powered by Ollama
- Uses LangChain for RAG implementation
- Vector storage by Chroma