Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeBase RAG

A powerful RAG (Retrieval-Augmented Generation) system for querying codebases using natural language. This tool allows you to ask questions about any codebase and get AI-powered responses based on the actual code content.

Features

  • Clone and process GitHub repositories
  • Extract code from multiple file types
  • Generate embeddings using HuggingFace models
  • Store and retrieve code snippets using Pinecone vector database
  • Query codebase using natural language
  • Get AI-powered responses using OpenRouter's LLM API

Prerequisites

  • Python 3.8+
  • Pinecone API key
  • OpenRouter API key

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/CodeBase_RAG.git
cd CodeBase_RAG
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Create a .env file in the root directory with your API keys:
PINECONE_API_KEY=your_pinecone_key
OPENROUTER_API_KEY=your_openrouter_key

Usage

  1. Run the main script:
python main.py
  1. The script will:

    • Clone the specified GitHub repository
    • Process all supported code files
    • Generate embeddings and store them in Pinecone
    • Allow you to query the codebase
  2. Example query:

response = rag_system.perform_rag("How to improve this repo?")

Supported File Types

  • Python (.py)
  • JavaScript (.js)
  • TypeScript (.ts, .tsx)
  • Java (.java)
  • C/C++ (.c, .cpp, .h)
  • Go (.go)
  • Rust (.rs)
  • Vue (.vue)
  • Swift (.swift)
  • Jupyter Notebooks (.ipynb)

Project Structure

CodeBase_RAG/
├── config/
│   ├── __init__.py
│   └── settings.py      # Configuration and constants
├── src/
│   ├── __init__.py
│   ├── repository.py    # Repository operations
│   ├── embeddings.py    # Embedding generation
│   └── rag.py          # RAG system implementation
├── main.py             # Main entry point
├── requirements.txt    # Project dependencies
└── README.md          # This file

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages