llama-github 0.3.3__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. {llama_github-0.3.3 → llama_github-0.4.1}/CHANGELOG.md +37 -0
  2. llama_github-0.4.1/MANIFEST.in +6 -0
  3. llama_github-0.4.1/PKG-INFO +173 -0
  4. {llama_github-0.3.3 → llama_github-0.4.1}/README.md +24 -42
  5. llama_github-0.4.1/llama_github/__init__.py +20 -0
  6. {llama_github-0.3.3 → llama_github-0.4.1}/llama_github/config/config.json +8 -1
  7. {llama_github-0.3.3 → llama_github-0.4.1}/llama_github/config/config.py +5 -8
  8. llama_github-0.4.1/llama_github/data_retrieval/github_api.py +393 -0
  9. {llama_github-0.3.3 → llama_github-0.4.1}/llama_github/data_retrieval/github_entities.py +767 -179
  10. llama_github-0.4.1/llama_github/github_integration/__init__.py +13 -0
  11. llama_github-0.4.1/llama_github/github_integration/github_auth_manager.py +492 -0
  12. llama_github-0.4.1/llama_github/github_rag.py +497 -0
  13. llama_github-0.4.1/llama_github/llm_integration/initial_load.py +248 -0
  14. llama_github-0.4.1/llama_github/llm_integration/llm_handler.py +119 -0
  15. llama_github-0.4.1/llama_github/logger.py +24 -0
  16. llama_github-0.4.1/llama_github/rag_processing/rag_processor.py +526 -0
  17. {llama_github-0.3.3 → llama_github-0.4.1}/llama_github/utils.py +53 -43
  18. llama_github-0.4.1/llama_github/version.py +1 -0
  19. llama_github-0.4.1/llama_github.egg-info/PKG-INFO +173 -0
  20. {llama_github-0.3.3 → llama_github-0.4.1}/llama_github.egg-info/SOURCES.txt +12 -5
  21. llama_github-0.4.1/llama_github.egg-info/requires.txt +23 -0
  22. llama_github-0.4.1/pyproject.toml +67 -0
  23. llama_github-0.4.1/pytest.ini +6 -0
  24. llama_github-0.4.1/scripts/__init__.py +1 -0
  25. llama_github-0.4.1/scripts/verify_distribution_contents.py +78 -0
  26. llama_github-0.4.1/setup.cfg +4 -0
  27. llama_github-0.4.1/setup.py +3 -0
  28. llama_github-0.4.1/tests/__init__.py +2 -0
  29. llama_github-0.4.1/tests/conftest.py +95 -0
  30. llama_github-0.4.1/tests/test_data_retrieval.py +657 -0
  31. llama_github-0.4.1/tests/test_distribution_contents.py +39 -0
  32. llama_github-0.4.1/tests/test_github_auth_manager.py +163 -0
  33. llama_github-0.4.1/tests/test_github_rag.py +78 -0
  34. llama_github-0.4.1/tests/test_initial_load.py +129 -0
  35. llama_github-0.4.1/tests/test_llm_handler.py +54 -0
  36. llama_github-0.4.1/tests/test_logger.py +29 -0
  37. llama_github-0.4.1/tests/test_logging_privacy.py +46 -0
  38. llama_github-0.4.1/tests/test_minimal_imports.py +33 -0
  39. llama_github-0.4.1/tests/test_rag_processor.py +79 -0
  40. llama_github-0.4.1/tests/test_utils.py +82 -0
  41. llama_github-0.3.3/MANIFEST.in +0 -2
  42. llama_github-0.3.3/PKG-INFO +0 -334
  43. llama_github-0.3.3/llama_github/__init__.py +0 -3
  44. llama_github-0.3.3/llama_github/data_retrieval/github_api.py +0 -317
  45. llama_github-0.3.3/llama_github/features/feature_flags.py +0 -0
  46. llama_github-0.3.3/llama_github/features/insider_features.py +0 -0
  47. llama_github-0.3.3/llama_github/github_integration/__init__.py +0 -7
  48. llama_github-0.3.3/llama_github/github_integration/github_auth_manager.py +0 -345
  49. llama_github-0.3.3/llama_github/github_rag.py +0 -523
  50. llama_github-0.3.3/llama_github/llm_integration/initial_load.py +0 -179
  51. llama_github-0.3.3/llama_github/llm_integration/llm_handler.py +0 -129
  52. llama_github-0.3.3/llama_github/logger.py +0 -15
  53. llama_github-0.3.3/llama_github/rag_processing/__init__.py +0 -0
  54. llama_github-0.3.3/llama_github/rag_processing/rag_processor.py +0 -500
  55. llama_github-0.3.3/llama_github/version.py +0 -1
  56. llama_github-0.3.3/llama_github.egg-info/PKG-INFO +0 -334
  57. llama_github-0.3.3/llama_github.egg-info/requires.txt +0 -19
  58. llama_github-0.3.3/setup.cfg +0 -37
  59. llama_github-0.3.3/setup.py +0 -16
  60. llama_github-0.3.3/tests/test_data_retrieval.py +0 -0
  61. llama_github-0.3.3/tests/test_github_auth_manager.py +0 -0
  62. llama_github-0.3.3/tests/test_initial_load.py +0 -0
  63. llama_github-0.3.3/tests/test_llm_handler.py +0 -0
  64. llama_github-0.3.3/tests/test_logger.py +0 -0
  65. llama_github-0.3.3/tests/test_rag_processor.py +0 -0
  66. {llama_github-0.3.3 → llama_github-0.4.1}/LICENSE +0 -0
  67. {llama_github-0.3.3 → llama_github-0.4.1}/llama_github/config/__init__.py +0 -0
  68. {llama_github-0.3.3 → llama_github-0.4.1}/llama_github/data_retrieval/__init__.py +0 -0
  69. {llama_github-0.3.3/llama_github/features → llama_github-0.4.1/llama_github/llm_integration}/__init__.py +0 -0
  70. {llama_github-0.3.3/llama_github/llm_integration → llama_github-0.4.1/llama_github/rag_processing}/__init__.py +0 -0
  71. {llama_github-0.3.3 → llama_github-0.4.1}/llama_github.egg-info/dependency_links.txt +0 -0
  72. {llama_github-0.3.3 → llama_github-0.4.1}/llama_github.egg-info/top_level.txt +0 -0
@@ -5,6 +5,42 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.1] - 2026-07-12
9
+
10
+ ### Added
11
+ - Added status-aware code/issue search APIs that distinguish `ok`, `no_hit`, `partial`, and `error`
12
+ - Added bounded pagination metadata for PR files and comments, plus the captured PR `head_sha`
13
+ - Added exact-head, bounded CI refresh with independently typed status/check-run evidence
14
+ - Added explicit repository-pool shutdown and an option to disable its cleanup worker
15
+
16
+ ### Changed
17
+ - Made the public `GithubRAG` import lazy so retrieval-only consumers do not import the ML/RAG stack
18
+ - Added connect/read timeouts, bounded REST pagination, privacy-safe logging, and immutable revisions for built-in Jina models
19
+ - Bounded related-issue extraction and expansion with configurable limits and truncation metadata
20
+ - Limited related-issue discovery to PR title/body and top-level PR comments, while retaining bare `#123` references in long descriptions
21
+ - Preserved review summaries and every inline review comment as separate chronological interactions
22
+ - Reduced commit-status history to the newest result per logical context while preserving fetched/current counts
23
+ - Raised dependency security floors while keeping the full install and public high-level RAG API compatible
24
+ - Hardened release and secret-scanning workflows with pinned actions, full-history scanning, checksum verification, and job-scoped PyPI OIDC
25
+ - Added a release artifact allowlist that rejects stale or unexplained files in the built wheel
26
+
27
+ ### Fixed
28
+ - Prevented Python AST parsing from being selected for non-Python paths based only on repository language metadata
29
+ - Fixed repository-pool cleanup so expired entries are actually evicted instead of retaining empty objects
30
+ - Fixed `get_pr_content()` so already-fetched PR comments participate in related-issue discovery instead of being processed too late
31
+
32
+ ## [0.4.0] - 2026-03-25
33
+
34
+ ### Changed
35
+ - Modernized packaging to `pyproject.toml` and raised the runtime floor to Python 3.10+
36
+ - Reworked LLM and GitHub integration layers to reduce stale compatibility paths and deprecated APIs
37
+ - Updated repository retrieval docs to reflect the actual return shapes and maintenance-focused project positioning
38
+
39
+ ### Fixed
40
+ - Corrected `simple_mode` behavior so it no longer depends on embedding and reranker initialization
41
+ - Fixed message composition order for chat history vs context handling
42
+ - Stabilized test execution and added runnable mock/real examples
43
+
8
44
  ## [0.3.3] - 2025-08-24
9
45
 
10
46
  ### Optimized
@@ -145,6 +181,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
145
181
  - Integration with LLM for processing and generating responses
146
182
 
147
183
  [0.1.4]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.3...v0.1.4
184
+ [0.4.1]: https://github.com/JetXu-LLM/llama-github/compare/v0.4.0...v0.4.1
148
185
  [0.1.3]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.2...v0.1.3
149
186
  [0.1.2]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.1...v0.1.2
150
187
  [0.1.1]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.0...v0.1.1
@@ -0,0 +1,6 @@
1
+ include llama_github/config/config.json
2
+ include CHANGELOG.md
3
+ include pytest.ini
4
+ include tests/*.py
5
+ include scripts/*.py
6
+ prune tests/self
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: llama-github
3
+ Version: 0.4.1
4
+ Summary: GitHub retrieval and context generation utilities for coding assistants and AI developer workflows.
5
+ Author-email: Jet Xu <Voldemort.xu@foxmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/JetXu-LLM/llama-github
8
+ Project-URL: Repository, https://github.com/JetXu-LLM/llama-github
9
+ Project-URL: Issues, https://github.com/JetXu-LLM/llama-github/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: PyGithub<3,>=2.4
21
+ Requires-Dist: PyJWT[crypto]<3,>=2.13
22
+ Requires-Dist: aiohttp<4,>=3.14.1
23
+ Requires-Dist: ipython<9,>=8.10
24
+ Requires-Dist: langchain-core<2,>=1.3.3
25
+ Requires-Dist: langchain-mistralai<2,>=1.0
26
+ Requires-Dist: langchain-openai<2,>=1.1.14
27
+ Requires-Dist: langchain-text-splitters<2,>=1.1.2
28
+ Requires-Dist: nest-asyncio<2,>=1.6
29
+ Requires-Dist: numpy<3,>=1.26.4
30
+ Requires-Dist: pydantic<3,>=2.10
31
+ Requires-Dist: python-dateutil<3,>=2.9
32
+ Requires-Dist: requests<3,>=2.33
33
+ Requires-Dist: tokenizers<1,>=0.22.1
34
+ Requires-Dist: transformers<6,>=5.3
35
+ Requires-Dist: urllib3<3,>=2.7
36
+ Provides-Extra: dev
37
+ Requires-Dist: build<2,>=1.2; extra == "dev"
38
+ Requires-Dist: pip-audit<3,>=2.10; extra == "dev"
39
+ Requires-Dist: pytest<10,>=9.0.3; extra == "dev"
40
+ Requires-Dist: pytest-asyncio<2,>=1.3; extra == "dev"
41
+ Requires-Dist: twine<7,>=6.2; extra == "dev"
42
+ Dynamic: license-file
43
+
44
+ # llama-github
45
+
46
+ [![PyPI version](https://badge.fury.io/py/llama-github.svg)](https://badge.fury.io/py/llama-github)
47
+ [![Downloads](https://static.pepy.tech/badge/Llama-github)](https://pepy.tech/project/Llama-github)
48
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
49
+
50
+ 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.
51
+
52
+ If you like this project or believe it has potential, please give it a ⭐️. Your support is our greatest motivation!
53
+
54
+ ## Architecture
55
+ ![High Level Architecture](./docs/high_level_architecture.drawio.svg)
56
+
57
+ ## Installation
58
+ ```
59
+ pip install llama-github
60
+ ```
61
+
62
+ Current maintained runtime target: Python `3.10` through `3.14`.
63
+
64
+ Version `0.4.1` keeps the existing high-level API while allowing retrieval-only
65
+ integrations to import GitHub and diff helpers without loading the ML/RAG dependency
66
+ stack. Built-in Jina models are pinned to immutable revisions; custom remote-code
67
+ models should provide their own immutable revision. Pull-request retrieval now keeps
68
+ bounded fetch-health metadata, expands related issues only from PR conversation
69
+ evidence, and preserves review summaries plus each inline comment without collapsing
70
+ them together.
71
+
72
+ ## Usage
73
+
74
+ Here's a simple example of how to use llama-github:
75
+
76
+ ```python
77
+ from llama_github import GithubRAG
78
+
79
+ # Initialize GithubRAG with your credentials
80
+ github_rag = GithubRAG(
81
+ github_access_token="your_github_access_token",
82
+ openai_api_key="your_openai_api_key", # Optional in Simple Mode
83
+ 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)
84
+ )
85
+
86
+ # Retrieve context for a coding question (simple_mode is default set to False)
87
+ query = "How to create a NumPy array in Python?"
88
+ contexts = github_rag.retrieve_context(
89
+ query,
90
+ # simple_mode = True
91
+ )
92
+
93
+ print(contexts[0]["url"])
94
+ print(contexts[0]["context"])
95
+
96
+ # Stop the optional repository-cache cleanup worker in long-lived applications.
97
+ github_rag.close()
98
+ ```
99
+
100
+ `retrieve_context()` returns a list of context dictionaries. Each item contains at least `context` and `url`.
101
+
102
+ For more advanced usage and examples, please refer to the [documentation](docs/usage.md). Runnable low-cost examples are also available in [`examples/`](examples).
103
+
104
+ ## Key Features
105
+
106
+ - **🔍 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.
107
+
108
+ - **⚡ 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.
109
+
110
+ - **🧠 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.
111
+
112
+ - **📚 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.
113
+
114
+ - **🚀 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.
115
+
116
+ - **🔧 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.
117
+
118
+ - **🔒 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.
119
+
120
+ - **🛠️ 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.
121
+
122
+ ## 🤖 Try Our AI-Powered PR Review Assistant: LlamaPReview
123
+
124
+ 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.
125
+
126
+ ### Key Features of LlamaPReview:
127
+ - 🚀 One-click installation, zero configuration required, fully auto-run
128
+ - 💯 Currently free to use - no credit card or payment info needed
129
+ - 🧠 AI-powered, automatic PR reviews with deep code understanding
130
+ - 🌐 Supports multiple programming languages
131
+
132
+ **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!
133
+
134
+ 👉 [Install LlamaPReview Now](https://github.com/marketplace/llamapreview/) (Free)
135
+
136
+ By using llama-github for context retrieval and LlamaPReview for code reviews, you can create a powerful, AI-enhanced development environment.
137
+
138
+ ## Vision and Roadmap
139
+
140
+ ### Vision
141
+
142
+ 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.
143
+
144
+ ![Vision Architecture](./docs/vision.drawio.svg)
145
+
146
+ ### Roadmap
147
+
148
+ For a historical view of the earlier roadmap, please visit [Vision and Roadmap](VISION_AND_ROADMAP.md).
149
+
150
+ ## Acknowledgments
151
+
152
+ We would like to express our gratitude to the following open-source projects for their support and contributions:
153
+
154
+ - **[LangChain](https://github.com/langchain-ai/langchain)**: For providing the foundational framework that empowers the LLM prompting and processing capabilities in llama-github.
155
+ - **[Jina.ai](https://github.com/jina-ai/reader)**: 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.
156
+
157
+ Their contributions have been instrumental in the development of llama-github, and we highly recommend checking out their projects for more innovative solutions.
158
+
159
+ ## Contributing
160
+
161
+ We welcome contributions to llama-github! Please see our [contributing guidelines](CONTRIBUTING.md) for more information.
162
+
163
+ ## License
164
+
165
+ This project is licensed under the terms of the Apache 2.0 license. See the [LICENSE](LICENSE) file for more details.
166
+
167
+ ## Contact
168
+
169
+ If you have any questions, suggestions, or feedback, please feel free to reach out to us at [Jet Xu's email](mailto:Voldemort.xu@foxmail.com).
170
+
171
+ ---
172
+
173
+ Thank you for choosing llama-github! We hope this library enhances your AI development experience and helps you build powerful applications with ease.
@@ -1,39 +1,5 @@
1
-
2
- <div align="right">
3
- <details>
4
- <summary >🌐 Language</summary>
5
- <div>
6
- <div align="center">
7
- <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=en">English</a>
8
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-CN">简体中文</a>
9
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-TW">繁體中文</a>
10
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ja">日本語</a>
11
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ko">한국어</a>
12
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=hi">हिन्दी</a>
13
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=th">ไทย</a>
14
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fr">Français</a>
15
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=de">Deutsch</a>
16
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=es">Español</a>
17
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=it">Italiano</a>
18
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ru">Русский</a>
19
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pt">Português</a>
20
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=nl">Nederlands</a>
21
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pl">Polski</a>
22
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ar">العربية</a>
23
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fa">فارسی</a>
24
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=tr">Türkçe</a>
25
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=vi">Tiếng Việt</a>
26
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=id">Bahasa Indonesia</a>
27
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=as">অসমীয়া</
28
- </div>
29
- </div>
30
- </details>
31
- </div>
32
-
33
1
  # llama-github
34
2
 
35
- [Detail Document] https://deepwiki.com/JetXu-LLM/llama-github
36
-
37
3
  [![PyPI version](https://badge.fury.io/py/llama-github.svg)](https://badge.fury.io/py/llama-github)
38
4
  [![Downloads](https://static.pepy.tech/badge/Llama-github)](https://pepy.tech/project/Llama-github)
39
5
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
@@ -50,6 +16,16 @@ If you like this project or believe it has potential, please give it a ⭐️. Y
50
16
  pip install llama-github
51
17
  ```
52
18
 
19
+ Current maintained runtime target: Python `3.10` through `3.14`.
20
+
21
+ Version `0.4.1` keeps the existing high-level API while allowing retrieval-only
22
+ integrations to import GitHub and diff helpers without loading the ML/RAG dependency
23
+ stack. Built-in Jina models are pinned to immutable revisions; custom remote-code
24
+ models should provide their own immutable revision. Pull-request retrieval now keeps
25
+ bounded fetch-health metadata, expands related issues only from PR conversation
26
+ evidence, and preserves review summaries plus each inline comment without collapsing
27
+ them together.
28
+
53
29
  ## Usage
54
30
 
55
31
  Here's a simple example of how to use llama-github:
@@ -66,29 +42,35 @@ github_rag = GithubRAG(
66
42
 
67
43
  # Retrieve context for a coding question (simple_mode is default set to False)
68
44
  query = "How to create a NumPy array in Python?"
69
- context = github_rag.retrieve_context(
70
- query, # In professional mode, one query will take nearly 1 min to generate final contexts. You could set log level to INFO to monitor the retrieval progress
45
+ contexts = github_rag.retrieve_context(
46
+ query,
71
47
  # simple_mode = True
72
48
  )
73
49
 
74
- print(context)
50
+ print(contexts[0]["url"])
51
+ print(contexts[0]["context"])
52
+
53
+ # Stop the optional repository-cache cleanup worker in long-lived applications.
54
+ github_rag.close()
75
55
  ```
76
56
 
77
- For more advanced usage and examples, please refer to the [documentation](docs/usage.md).
57
+ `retrieve_context()` returns a list of context dictionaries. Each item contains at least `context` and `url`.
58
+
59
+ For more advanced usage and examples, please refer to the [documentation](docs/usage.md). Runnable low-cost examples are also available in [`examples/`](examples).
78
60
 
79
61
  ## Key Features
80
62
 
81
63
  - **🔍 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.
82
64
 
83
- - **⚡ 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. Deploy llama-github in multi-threaded production environments with confidence, knowing that it will perform optimally and save you valuable resources.
65
+ - **⚡ 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.
84
66
 
85
67
  - **🧠 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.
86
68
 
87
69
  - **📚 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.
88
70
 
89
- - **🚀 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. Experience the difference as llama-github efficiently manages high-volume workloads without compromising on speed or quality.
71
+ - **🚀 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.
90
72
 
91
- - **🔧 Flexible LLM Integration**: Easily integrate llama-github with various LLM providers, embedding models, and reranking models to tailor the library's capabilities to your specific requirements. Our extensible architecture allows you to customize and enhance llama-github's functionality, ensuring that it adapts seamlessly to your unique development environment.
73
+ - **🔧 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.
92
74
 
93
75
  - **🔒 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.
94
76
 
@@ -120,7 +102,7 @@ Our vision is to become a pivotal module in the future of AI-driven development
120
102
 
121
103
  ### Roadmap
122
104
 
123
- For a detailed view of our project roadmap, please visit our [Project Roadmap](https://github.com/users/JetXu-LLM/projects/2).
105
+ For a historical view of the earlier roadmap, please visit [Vision and Roadmap](VISION_AND_ROADMAP.md).
124
106
 
125
107
  ## Acknowledgments
126
108
 
@@ -0,0 +1,20 @@
1
+ """Public package surface with heavyweight RAG imports loaded on demand."""
2
+
3
+ from .logger import configure_logging
4
+ from .version import __version__
5
+
6
+ __all__ = ["GithubRAG", "__version__", "configure_logging"]
7
+
8
+
9
+ def __getattr__(name: str):
10
+ """Preserve ``from llama_github import GithubRAG`` without eager ML imports."""
11
+ if name == "GithubRAG":
12
+ from .github_rag import GithubRAG
13
+
14
+ return GithubRAG
15
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
16
+
17
+
18
+ def __dir__():
19
+ """Expose lazy public attributes to introspection tools."""
20
+ return sorted(set(globals()) | set(__all__))
@@ -5,16 +5,23 @@
5
5
  "issue_search_criteria_prompt": "**Instructions:**\n- **Question-Driven GitHub Issue Search Criteria Generation:** Generate GitHub issue search criteria strings based on the provided question. Analyze the question to identify key concepts, technologies, and problem-solving approaches that can help locate relevant issues on GitHub. Consider using relevant `label:` or `is:` qualifiers when applicable.\n\n**Output Format:** Present each search criteria string on a new line, formatted for immediate use in GitHub's issue search, without additional explanations or commentary.\n\n**Optimization Considerations:**\n- **Keyword Relevance:** Extract keywords and phrases tightly related to the question that are likely to appear in issue titles, descriptions, and discussions. Prioritize terms that reflect specific problems, error messages, or technologies. Avoid generic terms like \"help\" or \"problem\" that may not effectively narrow down the search results.\n- **Contextual Understanding:** Use the question's draft answer to inform your keyword selection. Identify key aspects, technologies, or potential troubleshooting areas tightly related to the question but not only specific aspects of answers that can help refine the search criteria.\n- **Simplicity and Effectiveness:** Craft search criteria with simple and limited keywords which could lead to precise search results relevant to the original question. Strike a balance between specificity and breadth to ensure the criteria capture the essential aspects of the question without being overly restrictive.\n- **Multiple Perspectives:** Generate multiple search criteria strings that approach the question from different angles or emphasize different aspects mentioned in the question. This increases the chances of finding relevant issues that discuss similar problems or solutions.\n- **Leveraging Labels:** When appropriate, include relevant `label:` qualifiers in the search criteria to narrow down the results to issues with specific labels, such as \"bug,\" \"enhancement,\" or \"documentation.\" This can help focus the search on issues that align with the nature of the question.\n- **Considering Issue Discussions:** Keep in mind that issue discussions often contain valuable information, experiences, and workarounds shared by other developers. Craft search criteria that not only match the issue title and description but also consider the likelihood of the keywords appearing in the issue's comments and discussions.",
6
6
  "repo_search_criteria_prompt": "**Instructions:**\n- **Expertise-Driven Github Repository Search Criteria Generation:** Generate GitHub repo search criteria strings based on the provided question. Analyze the question leverage your expertise for related key concepts, technologies, and problem-solving approaches that can help locate relevant repositories on GitHub. Focus on practical keywords and phrases likely to be present in repository names, descriptions, and topics. Use the `language:` qualifier to direct your search toward repositories written in a specific language, keeping the criteria simple and effective.\n- **Necessity Score Determination:** Evaluate the necessity of conducting a GitHub repository search based on the difficulty of question. Determine if repository-level information is essential to comprehensively address the question. Assign a necessity score indicating the importance of performing a repository search.\n\n**Output Format:**\n- **Necessity Score:** Begin your output with a necessity score (0-100) indicating the importance of performing a separate GitHub repository search. Use the following scale:\n - 0-59: Low necessity - Only code and issue search results is sufficient.\n - 60-79: Medium necessity - One repository search may offer additional insights and context.\n - 80-100: High necessity - Two repository searches are crucial to gather comprehensive information, such as project structure, documentation, or community engagement, to thoroughly address the question.\n\n- **Search Criteria:** Present each search criteria string on a new line, formatted for immediate use in GitHub's repository search, without additional explanations or commentary.\n**Optimization Considerations:**\n- **Keyword Relevance:** Generate search criteria keywords and phrases from the question that are uniquely relevant to repository names, descriptions, and topics. Prioritize terms that reflect the broader context, expertise, and strategic thinking required to address the question effectively. Avoid generic terms that may lead to irrelevant search results.\n- **Simplicity and Effectiveness:** Craft search criteria that are simple yet effective in narrowing down the repository search results to the most relevant and informative ones. Strike a balance between specificity and breadth, ensuring that the criteria capture the essential aspects of the question without being overly restrictive. Aim for criteria that yield a manageable number of high-quality repository results.\n- **Language and Platform Specificity:** If the question pertains to a specific programming language or platform, incorporate relevant language or platform-specific keywords in the search criteria. Use the `language:` qualifier to filter repositories based on the language of interest. This helps focus the search on repositories that are more likely to contain relevant code, documentation, and community expertise.\n- **Multiple Criteria Flexibility:** Generate multiple search criteria strings that approach the question from different angles or emphasize different aspects mentioned in the question. This flexibility allows for a more comprehensive repository search, increasing the chances of discovering relevant repositories that may offer valuable insights, code samples, or best practices related to the question at hand.",
7
7
  "scoring_context_prompt": "You are an expert in evaluating the relevance of coding-related contexts to given questions. Your primary function is to analyze the provided context and question, and output a single integer score between 0 and 100, indicating how well the context supports answering the question.\n\nScoring criteria:\n0-20: The context is completely irrelevant to the question and provides no useful information to answer it.\n21-40: The context is slightly relevant to the question but lacks crucial information to provide a complete answer.\n41-60: The context is somewhat relevant to the question and provides some useful information, but it may not be sufficient to fully answer the question.\n61-80: The context is highly relevant to the question and provides most of the necessary information to answer it, but some minor details may be missing.\n81-100: The context is extremely relevant to the question and provides all the necessary information to comprehensively answer it.\n\nRemember, your output should consist of only a single integer score without any additional text or explanation. Analyze the context and question carefully, and provide a score that accurately reflects the relevance of the context in answering the question.",
8
+ "default_openai_model": "gpt-4o-mini",
9
+ "default_openai_simple_model": "gpt-4o-mini",
10
+ "default_mistral_model": "mistral-small-latest",
11
+ "default_mistral_simple_model": "mistral-small-latest",
8
12
  "default_embedding": "jinaai/jina-embeddings-v2-base-code",
13
+ "default_embedding_revision": "516f4baf13dec4ddddda8631e019b5737c8bc250",
9
14
  "default_reranker": "jinaai/jina-reranker-v2-base-multilingual",
15
+ "default_reranker_revision": "9cfeff2df7d40d1b78e75e5e9cebec92a99813c9",
10
16
  "min_stars_to_keep_result": 20,
11
17
  "max_workers": 8,
12
18
  "code_search_max_hits": 30,
13
19
  "issue_search_max_hits": 30,
14
20
  "repo_search_max_hits": 10,
21
+ "related_issue_max_hits": 20,
15
22
  "chunk_size": 2000,
16
23
  "issue_chunk_size": 7000,
17
24
  "repo_chunk_size": 7000,
18
25
  "google_chunk_size": 7000,
19
26
  "top_n_contexts": 4
20
- }
27
+ }
@@ -1,11 +1,9 @@
1
- # config.py
2
1
  import json
3
- from importlib import resources
4
- from llama_github.logger import logger
2
+ from importlib.resources import files
5
3
 
6
- # utils.py
7
4
  class SingletonMeta(type):
8
5
  _instances = {}
6
+
9
7
  def __call__(cls, *args, **kwargs):
10
8
  if cls not in cls._instances:
11
9
  instance = super().__call__(*args, **kwargs)
@@ -17,14 +15,13 @@ class Config(metaclass=SingletonMeta):
17
15
 
18
16
  def __init__(self):
19
17
  if Config._config is None:
20
- with resources.open_text('llama_github.config', 'config.json') as file:
21
- Config._config = json.load(file)
18
+ config_path = files("llama_github.config").joinpath("config.json")
19
+ Config._config = json.loads(config_path.read_text(encoding="utf-8"))
22
20
 
23
21
  @classmethod
24
22
  def get(cls, key, default=None):
25
- # Ensure the singleton instance is created
26
23
  if cls._config is None:
27
24
  cls()
28
25
  return cls._config.get(key, default)
29
26
 
30
- config = Config()
27
+ config = Config()