Skip to main content

llama-github

PyPI version Downloads License

Llama-github is a powerful tool that helps you retrieve(based on Agentic RAG) the most relevant code snippets, issues, and repository information from GitHub based on your queries, transforming them into valuable knowledge context. It empowers LLM Chatbots, AI Agents, and Auto-dev Agents to solve complex coding tasks. Whether you're a developer looking for quick solutions or an engineer implementing advanced Auto Dev AI Agents, llama-github makes it easy and efficient.

If you like this project or believe it has potential, please give it a ⭐️. Your support is our greatest motivation!

Architecture

High Level Architecture

Installation

pip install llama-github

Current maintained runtime target: Python 3.10 through 3.14.

Version 0.4.6 keeps the existing high-level API while allowing retrieval-only integrations to import GitHub and diff helpers without loading the ML/RAG dependency stack. Built-in Jina models are pinned to immutable revisions; custom remote-code models should provide their own immutable revision. Pull-request retrieval now keeps bounded fetch-health metadata, expands related issues only from PR conversation evidence, and preserves review summaries plus each inline comment without collapsing them together. Repository-qualified links are identity-aware, so upstream release-note links are not expanded as same-repository issues. Deterministic planners can explicitly opt into typed, 2 MiB-capped lockfile or CI-config reads without weakening the generic file policy. Memory-sensitive PR consumers can also opt into per-file and cumulative source limits; oversized source falls back to GitHub's changed-file patch without changing the default retrieval API. Exact-head CI snapshots expose stable check-run identity, latest-attempt semantics, bounded page completeness, and retained evidence from partial failures. Synthetic new-file/deletion diffs use standard unified markers without inserting source spaces.

Usage

Here's a simple example of how to use llama-github:

from llama_github import GithubRAG

# Initialize GithubRAG with your credentials
github_rag = GithubRAG(
    github_access_token="your_github_access_token", 
    openai_api_key="your_openai_api_key", # Optional in Simple Mode
    jina_api_key="your_jina_api_key" # Optional - unless you want high concurrency production deployment (s.jina.ai API will be used in llama-github)
)

# Retrieve context for a coding question (simple_mode is default set to False)
query = "How to create a NumPy array in Python?"
contexts = github_rag.retrieve_context(
    query,
    # simple_mode = True
)

print(contexts[0]["url"])
print(contexts[0]["context"])

# Stop the optional repository-cache cleanup worker in long-lived applications.
github_rag.close()

retrieve_context() returns a list of context dictionaries. Each item contains at least context and url.

For more advanced usage and examples, please refer to the documentation. Runnable low-cost examples are also available in examples/.

Key Features

  • 🔍 Intelligent GitHub Retrieval: Harness the power of llama-github to retrieve highly relevant code snippets, issues, and repository information from GitHub based on user queries. Our advanced retrieval techniques ensure you find the most pertinent information quickly and efficiently.

  • ⚡ Repository Pool Caching: Llama-github has an innovative repository pool caching mechanism. By caching repositories (including READMEs, structures, code, and issues) across threads, llama-github significantly accelerates GitHub search retrieval efficiency and minimizes the consumption of GitHub API tokens.

  • 🧠 LLM-Powered Question Analysis: Leverage state-of-the-art language models to analyze user questions and generate highly effective search strategies and criteria. Llama-github intelligently breaks down complex queries, ensuring that you retrieve the most relevant information from GitHub's vast repository network.

  • 📚 Comprehensive Context Generation: Generate rich, contextually relevant answers by seamlessly combining information retrieved from GitHub with the reasoning capabilities of advanced language models. Llama-github excels at handling even the most complex and lengthy questions, providing comprehensive and insightful responses that include extensive context to support your development needs.

  • 🚀 Asynchronous Processing Excellence: Llama-github is built from the ground up to leverage the full potential of asynchronous programming. With meticulously implemented asynchronous mechanisms woven throughout the codebase, llama-github can handle multiple requests concurrently, significantly boosting overall performance.

  • 🔧 Flexible LLM Integration: Easily integrate llama-github with various LLM providers, embedding models, reranking models, or an injected LangChain-compatible chat model to tailor the library's capabilities to your specific requirements.

  • 🔒 Robust Authentication Options: Llama-github supports both personal access tokens and GitHub App authentication, providing you with the flexibility to integrate it into different development setups. Whether you're an individual developer or working within an organizational context, llama-github has you covered with secure and reliable authentication mechanisms.

  • 🛠️ Logging and Error Handling: We understand the importance of smooth operations and easy troubleshooting. That's why llama-github comes equipped with comprehensive logging and error handling mechanisms. Gain deep insights into the library's behavior, quickly diagnose issues, and maintain a stable and reliable development workflow.

🤖 Try Our AI-Powered PR Review Assistant: LlamaPReview

If you find llama-github useful, you might also be interested in our AI-powered GitHub PR review assistant, LlamaPReview. It's designed to complement your development workflow and further enhance code quality.

Key Features of LlamaPReview:

  • 🚀 One-click installation, zero configuration required, fully auto-run
  • 💯 Currently free to use - no credit card or payment info needed
  • 🧠 AI-powered, automatic PR reviews with deep code understanding
  • 🌐 Supports multiple programming languages

LlamaPReview utilizes llama-github's advanced context retrieval and LLM-powered analysis to provide intelligent, context-aware code reviews. It's like having a senior developer, armed with the full context of your repository, review every PR automatically!

👉 Install LlamaPReview Now (Free)

By using llama-github for context retrieval and LlamaPReview for code reviews, you can create a powerful, AI-enhanced development environment.

Vision and Roadmap

Vision

Our vision is to become a pivotal module in the future of AI-driven development solutions, seamlessly integrating with GitHub to empower LLMs in automatically resolving complex coding tasks.

Vision Architecture

Roadmap

For a historical view of the earlier roadmap, please visit Vision and Roadmap.

Acknowledgments

We would like to express our gratitude to the following open-source projects for their support and contributions:

  • LangChain: For providing the foundational framework that empowers the LLM prompting and processing capabilities in llama-github.
  • Jina.ai: For offering s.jina.ai API and open source reranker and embedding models that enhance the accuracy and relevance of the generated contexts in llama-github.

Their contributions have been instrumental in the development of llama-github, and we highly recommend checking out their projects for more innovative solutions.

Contributing

We welcome contributions to llama-github! Please see our contributing guidelines for more information.

License

This project is licensed under the terms of the Apache 2.0 license. See the LICENSE file for more details.

Contact

If you have any questions, suggestions, or feedback, please feel free to reach out to us at Jet Xu's email.


Thank you for choosing llama-github! We hope this library enhances your AI development experience and helps you build powerful applications with ease.

Metadata

Release files for llama-github 0.4.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-github 0.4.6
File Size Uploaded
llama_github-0.4.6.tar.gz 85.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-github 0.4.6
File Interpreter ABI Platform
llama_github-0.4.6-py3-none-any.whl Python 3 none any Details

Total release size: 151.0 kB

Release files / llama_github-0.4.6.tar.gz

Download URL llama_github-0.4.6.tar.gz
Size 85.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1b98b8554ed97935beccd480b5217199c1cc6fd98e71edcdfe79c584c1f1e84f
BLAKE2b-256 checksum
How to use checksums
abe8a1a8b9a46d599ad42703b9ebfda355ef6e68fa43736bd20a7c6a555f0a83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release files / llama_github-0.4.6-py3-none-any.whl

Download URL llama_github-0.4.6-py3-none-any.whl
Size 65.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d43ebf756cbd29fdfbd47b11e996c71a1967d03c5bcf65e27a1dcb09447e3553
BLAKE2b-256 checksum
How to use checksums
3d73fab8f26cd346aae607dace23fb81dee412bf13aacd8cb3283a6fd3200335
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.6 This release

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page