Skip to content

itsmuriuki/RepoMentor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

RepoMentor ๐Ÿค–

Your AI GitHub Assistant โ€“ Ask questions about GitHub repositories and get intelligent answers powered by advanced AI.

Python Streamlit Gemini AI License


๐Ÿ“‹ Overview

Repomentor is an intelligent AI-powered assistant that helps developers understand and interact with GitHub repositories. Using advanced natural language processing and hybrid search capabilities, aihero can answer questions about repository content, provide code explanations, and assist with development workflows.

Key Features

  • ๐Ÿค– AI-Powered Q&A: Get intelligent answers about repository content using Google Gemini AI.
  • ๐Ÿ” Hybrid Search: Combines text-based and semantic search for accurate results.
  • ๐Ÿ’ฌ Interactive Chat: User-friendly Streamlit web interface.
  • ๐Ÿ“Š Repository Analysis: Indexes and analyzes GitHub repository data.
  • ๐Ÿ”ง CLI & Web Interfaces: Choose between command-line or graphical interface.
  • ๐Ÿ“ Comprehensive Logging: Track interactions and performance metrics.
  • ๐Ÿ›ก๏ธ Error Handling: Robust error handling with user-friendly messages.

Target Audience

  • Developers looking to understand large codebases quickly.
  • Open Source Contributors exploring new projects.
  • Students learning from real-world code examples.
  • Teams needing quick answers about their repositories.

๐Ÿš€ Installation

Prerequisites

  • Python 3.13 or higher
  • OPENAI API key

Step-by-Step Setup

  1. Clone the repository

    git clone https://github.com/itsmuriuki/aihero.git
    cd aihero/projects
  2. Install dependencies

    # Using poetry (recommended)
    poetry install
    
    # Or using pip
    pip install -r requirements.txt
  3. Set up environment variables Create a .env file in the project root:

    OPENAI_API_KEY=your_gemini_api_key_here
    
  4. Run the application

    Web Interface (Recommended):

    streamlit run app.py

    Open http://localhost:8501 in your browser.

    Command Line Interface:

    python main.py

๐ŸŽฎ Usage

Web Interface

The Streamlit app provides an intuitive chat interface where you can:

  • Ask questions about GitHub repositories.
  • Get AI-powered explanations and code insights.
  • View conversation history.
  • Access comprehensive error handling.

Example Questions:

  • "How do I set up a Kafka producer in Python?"
  • "What are the best practices for error handling?"
  • "Explain the repository structure and main components."

Command Line Interface

For programmatic or headless usage:

python main.py

Type your questions interactively. Type stop to exit.

Programmatic Usage

import asyncio
from ingest import index_data
from search_agent import init_agent

# Initialize the system
index = index_data("DataTalksClub", "faq")  # Replace with your repo
agent = init_agent(index, "DataTalksClub", "faq")

async def ask_question(question):
    response = await agent.run(user_prompt=question)
    return response.output

answer = asyncio.run(ask_question("How do I run Kafka with Python?"))
print(answer)

๐Ÿ“ Project Structure

aihero/projects
โ”œโ”€โ”€ app.py               # Streamlit web application
โ”œโ”€โ”€ main.py              # Command-line interface
โ”œโ”€โ”€ ingest.py            # Data ingestion and indexing
โ”œโ”€โ”€ search_agent.py      # Pydantic AI agent configuration
โ”œโ”€โ”€ search_tools.py      # Search functionality and tools
โ”œโ”€โ”€ logs.py              # Logging utilities
โ”œโ”€โ”€ pyproject.toml       # Project configuration and dependencies
โ”œโ”€โ”€ requirements.txt     # Alternative dependency management
โ”œโ”€โ”€ .env                 # Environment variables (create this)
โ”œโ”€โ”€ src/                 # Core modules
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ agent_logic.py
โ”‚   โ”œโ”€โ”€ data_processing.py
โ”‚   โ”œโ”€โ”€ evaluation.py
โ”‚   โ”œโ”€โ”€ logging_utils.py
โ”‚   โ””โ”€โ”€ search_engine.py
โ”œโ”€โ”€ tests/               # Test suite
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ run_tests.py
โ”‚   โ”œโ”€โ”€ test_*.py
โ”œโ”€โ”€ logs/                # Generated log files
โ””โ”€โ”€ __pycache__/         # Python cache (generated)

๐Ÿ› ๏ธ Technologies Used

Core Dependencies

Development Tools

  • Python 3.13+ โ€“ Core programming language.
  • uv โ€“ Fast Python package manager.
  • pytest โ€“ Testing framework.
  • Jupyter โ€“ Interactive development notebooks.

Infrastructure

  • GitHub API โ€“ Repository data access.
  • Environment Variables โ€“ Configuration management.
  • JSON Logging โ€“ Structured interaction logging.

๐Ÿงช Evaluations

We evaluate the agent using the following criteria:

  • instructions_follow: The agent followed the user's instructions
  • instructions_avoid: The agent avoided doing things it was told not to do
  • answer_relevant: The response directly addresses the user's question
  • answer_clear: The answer is clear and correct
  • answer_citations: The response includes proper citations or sources when required
  • completeness: The response is complete and covers all key aspects of the request
  • tool_call_search: Is the search tool invoked?

We do this in two steps:

  1. First, we generate synthetic questions (see eval/data-gen.ipynb)
  2. Next, we run our agent on the generated questions and check the criteria (see eval/evaluations.ipynb)

Current evaluation metrics

instructions_follow    79.3
instructions_avoid     96.3
answer_relevant        100.0
answer_clear           100.0
answer_citations       74.1
completeness           100.0
tool_call_search       88.9

The most important metric for this project is answer_relevant. This measures whether the system's answer is relevant to the user. It's currently 100%, meaning all answers were relevant.


๐Ÿค Contributing

We welcome contributions!

Development Setup

  1. Fork the repository.

  2. Create a feature branch:

    git checkout -b feature/your-feature
  3. Install development dependencies:

    poetry install
  4. Run tests:

    python tests/run_tests.py

Guidelines

  • Code Style: Follow PEP 8 standards.
  • Testing: Add tests for new features.
  • Documentation: Update README for significant changes.
  • Commits: Use clear, descriptive commit messages.

Pull Request Process

  1. Ensure all tests pass.
  2. Update documentation if needed.
  3. Create a pull request with a clear description.
  4. Wait for review and address feedback.

๐Ÿ“„ License

This project is licensed under the MIT License โ€“ see the LICENSE file for details.

The MIT License allows for:

  • โœ… Commercial use
  • โœ… Modification
  • โœ… Distribution
  • โœ… Private use
  • โš ๏ธ No liability or warranty

๐Ÿ™ Acknowledgments

Core Technologies

  • Google Gemini AI โ€“ Powerful language model.
  • Pydantic AI โ€“ Agent framework.
  • Streamlit โ€“ Web interface framework.
  • minsearch โ€“ Efficient text search functionality.

Inspiration & Resources

  • DataTalksClub โ€“ FAQ repository used in demos.
  • Open Source Community โ€“ Amazing tools and libraries.
  • AI Research Community โ€“ Advancing AI assistants.

Special Thanks

  • Built with โค๏ธ for developers who want to understand codebases faster.
  • Special acknowledgment to the AI agent development community.

Support

Author

Gerald Muriuki


Transform how you understand and interact with GitHub repositories ๐Ÿš€

About

RepoMentor is an AI assistant that helps you understand GitHub repositories. It answers questions, explains code, and guides you through docs โ€” like a mentor for your repos. ๐Ÿš€ Resources

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors