llama-github 0.3.2__tar.gz → 0.4.0__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 (59) hide show
  1. {llama_github-0.3.2 → llama_github-0.4.0}/CHANGELOG.md +17 -0
  2. {llama_github-0.3.2/llama_github.egg-info → llama_github-0.4.0}/PKG-INFO +73 -180
  3. {llama_github-0.3.2 → llama_github-0.4.0}/README.md +44 -8
  4. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github/config/config.json +5 -1
  5. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github/config/config.py +5 -8
  6. llama_github-0.4.0/llama_github/data_retrieval/github_api.py +243 -0
  7. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github/data_retrieval/github_entities.py +41 -40
  8. llama_github-0.4.0/llama_github/github_integration/github_auth_manager.py +222 -0
  9. llama_github-0.4.0/llama_github/github_rag.py +464 -0
  10. llama_github-0.4.0/llama_github/llm_integration/initial_load.py +211 -0
  11. llama_github-0.4.0/llama_github/llm_integration/llm_handler.py +119 -0
  12. llama_github-0.4.0/llama_github/logger.py +24 -0
  13. llama_github-0.4.0/llama_github/rag_processing/rag_processor.py +510 -0
  14. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github/utils.py +122 -39
  15. llama_github-0.4.0/llama_github/version.py +1 -0
  16. {llama_github-0.3.2 → llama_github-0.4.0/llama_github.egg-info}/PKG-INFO +73 -180
  17. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github.egg-info/SOURCES.txt +4 -5
  18. llama_github-0.4.0/llama_github.egg-info/requires.txt +20 -0
  19. llama_github-0.4.0/pyproject.toml +62 -0
  20. llama_github-0.4.0/setup.cfg +4 -0
  21. llama_github-0.4.0/setup.py +3 -0
  22. llama_github-0.4.0/tests/test_data_retrieval.py +118 -0
  23. llama_github-0.4.0/tests/test_github_auth_manager.py +85 -0
  24. llama_github-0.4.0/tests/test_github_rag.py +33 -0
  25. llama_github-0.4.0/tests/test_initial_load.py +67 -0
  26. llama_github-0.4.0/tests/test_llm_handler.py +54 -0
  27. llama_github-0.4.0/tests/test_logger.py +29 -0
  28. llama_github-0.4.0/tests/test_rag_processor.py +79 -0
  29. llama_github-0.4.0/tests/test_utils.py +69 -0
  30. llama_github-0.3.2/llama_github/data_retrieval/github_api.py +0 -317
  31. llama_github-0.3.2/llama_github/features/feature_flags.py +0 -0
  32. llama_github-0.3.2/llama_github/features/insider_features.py +0 -0
  33. llama_github-0.3.2/llama_github/github_integration/github_auth_manager.py +0 -345
  34. llama_github-0.3.2/llama_github/github_rag.py +0 -523
  35. llama_github-0.3.2/llama_github/llm_integration/initial_load.py +0 -179
  36. llama_github-0.3.2/llama_github/llm_integration/llm_handler.py +0 -129
  37. llama_github-0.3.2/llama_github/logger.py +0 -15
  38. llama_github-0.3.2/llama_github/rag_processing/__init__.py +0 -0
  39. llama_github-0.3.2/llama_github/rag_processing/rag_processor.py +0 -500
  40. llama_github-0.3.2/llama_github/version.py +0 -1
  41. llama_github-0.3.2/llama_github.egg-info/requires.txt +0 -19
  42. llama_github-0.3.2/setup.cfg +0 -37
  43. llama_github-0.3.2/setup.py +0 -16
  44. llama_github-0.3.2/tests/test_data_retrieval.py +0 -0
  45. llama_github-0.3.2/tests/test_github_auth_manager.py +0 -0
  46. llama_github-0.3.2/tests/test_initial_load.py +0 -0
  47. llama_github-0.3.2/tests/test_llm_handler.py +0 -0
  48. llama_github-0.3.2/tests/test_logger.py +0 -0
  49. llama_github-0.3.2/tests/test_rag_processor.py +0 -0
  50. {llama_github-0.3.2 → llama_github-0.4.0}/LICENSE +0 -0
  51. {llama_github-0.3.2 → llama_github-0.4.0}/MANIFEST.in +0 -0
  52. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github/__init__.py +0 -0
  53. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github/config/__init__.py +0 -0
  54. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github/data_retrieval/__init__.py +0 -0
  55. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github/github_integration/__init__.py +0 -0
  56. {llama_github-0.3.2/llama_github/features → llama_github-0.4.0/llama_github/llm_integration}/__init__.py +0 -0
  57. {llama_github-0.3.2/llama_github/llm_integration → llama_github-0.4.0/llama_github/rag_processing}/__init__.py +0 -0
  58. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github.egg-info/dependency_links.txt +0 -0
  59. {llama_github-0.3.2 → llama_github-0.4.0}/llama_github.egg-info/top_level.txt +0 -0
@@ -5,6 +5,23 @@ 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.0] - 2026-03-25
9
+
10
+ ### Changed
11
+ - Modernized packaging to `pyproject.toml` and raised the runtime floor to Python 3.10+
12
+ - Reworked LLM and GitHub integration layers to reduce stale compatibility paths and deprecated APIs
13
+ - Updated repository retrieval docs to reflect the actual return shapes and maintenance-focused project positioning
14
+
15
+ ### Fixed
16
+ - Corrected `simple_mode` behavior so it no longer depends on embedding and reranker initialization
17
+ - Fixed message composition order for chat history vs context handling
18
+ - Stabilized test execution and added runnable mock/real examples
19
+
20
+ ## [0.3.3] - 2025-08-24
21
+
22
+ ### Optimized
23
+ - Enhance diff hunk header
24
+
8
25
  ## [0.3.2] - 2025-06-23
9
26
 
10
27
  ### Optimized
@@ -1,36 +1,71 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llama-github
3
- Version: 0.3.2
4
- Summary: Llama-github is an open-source Python library that empowers LLM Chatbots, AI Agents, and Auto-dev Agents to conduct Retrieval from actively selected GitHub public projects. It Augments through LLMs and Generates context for any coding question, in order to streamline the development of sophisticated AI-driven applications.
5
- Home-page: https://github.com/JetXu-LLM/llama-github
6
- Author: Jet Xu
7
- Author-email: Voldemort.xu@foxmail.com
3
+ Version: 0.4.0
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
8
10
  Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
10
14
  Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.6
15
+ Requires-Python: >=3.10
12
16
  Description-Content-Type: text/markdown
13
17
  License-File: LICENSE
14
- Requires-Dist: aiohttp
15
- Requires-Dist: asyncio
16
- Requires-Dist: PyGithub
17
- Requires-Dist: langchain
18
- Requires-Dist: numpy
19
- Requires-Dist: pydantic
20
- Requires-Dist: requests
21
- Requires-Dist: transformers
22
- Requires-Dist: urllib3
23
- Requires-Dist: pydantic_core
24
- Requires-Dist: langchain_openai
25
- Requires-Dist: langchain_mistralai
26
- Requires-Dist: httpx_sse
27
- Requires-Dist: tokenizers
18
+ Requires-Dist: PyGithub<3,>=2.4
19
+ Requires-Dist: aiohttp<4,>=3.9
20
+ Requires-Dist: ipython<9,>=8
21
+ Requires-Dist: langchain-core<0.4,>=0.3.30
22
+ Requires-Dist: langchain-mistralai<0.3,>=0.2
23
+ Requires-Dist: langchain-openai<0.4,>=0.3.0
24
+ Requires-Dist: langchain-text-splitters<0.4,>=0.3.0
25
+ Requires-Dist: nest-asyncio<2,>=1.6
26
+ Requires-Dist: numpy<3,>=1.24
27
+ Requires-Dist: pydantic<3,>=2.10
28
+ Requires-Dist: python-dateutil<3,>=2.9
29
+ Requires-Dist: requests<3,>=2.31
30
+ Requires-Dist: tokenizers<1,>=0.20
31
+ Requires-Dist: transformers<6,>=4.47
32
+ Requires-Dist: urllib3<3,>=2
28
33
  Provides-Extra: dev
29
- Requires-Dist: pytest; extra == "dev"
30
- Requires-Dist: black; extra == "dev"
31
- Requires-Dist: flake8; extra == "dev"
34
+ Requires-Dist: build<2,>=1.2; extra == "dev"
35
+ Requires-Dist: pytest<9,>=8.3; extra == "dev"
36
+ Requires-Dist: pytest-asyncio<1,>=0.25; extra == "dev"
32
37
  Dynamic: license-file
33
- Dynamic: requires-dist
38
+
39
+
40
+ <div align="right">
41
+ <details>
42
+ <summary >🌐 Language</summary>
43
+ <div>
44
+ <div align="center">
45
+ <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=en">English</a>
46
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-CN">简体中文</a>
47
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=zh-TW">繁體中文</a>
48
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ja">日本語</a>
49
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ko">한국어</a>
50
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=hi">हिन्दी</a>
51
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=th">ไทย</a>
52
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fr">Français</a>
53
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=de">Deutsch</a>
54
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=es">Español</a>
55
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=it">Italiano</a>
56
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ru">Русский</a>
57
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pt">Português</a>
58
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=nl">Nederlands</a>
59
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=pl">Polski</a>
60
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=ar">العربية</a>
61
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=fa">فارسی</a>
62
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=tr">Türkçe</a>
63
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=vi">Tiếng Việt</a>
64
+ | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=id">Bahasa Indonesia</a>
65
+ </div>
66
+ </div>
67
+ </details>
68
+ </div>
34
69
 
35
70
  # llama-github
36
71
 
@@ -52,6 +87,8 @@ If you like this project or believe it has potential, please give it a ⭐️. Y
52
87
  pip install llama-github
53
88
  ```
54
89
 
90
+ Current maintained runtime target: Python `3.10+`.
91
+
55
92
  ## Usage
56
93
 
57
94
  Here's a simple example of how to use llama-github:
@@ -68,29 +105,32 @@ github_rag = GithubRAG(
68
105
 
69
106
  # Retrieve context for a coding question (simple_mode is default set to False)
70
107
  query = "How to create a NumPy array in Python?"
71
- context = github_rag.retrieve_context(
72
- 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
108
+ contexts = github_rag.retrieve_context(
109
+ query,
73
110
  # simple_mode = True
74
111
  )
75
112
 
76
- print(context)
113
+ print(contexts[0]["url"])
114
+ print(contexts[0]["context"])
77
115
  ```
78
116
 
79
- For more advanced usage and examples, please refer to the [documentation](docs/usage.md).
117
+ `retrieve_context()` returns a list of context dictionaries. Each item contains at least `context` and `url`.
118
+
119
+ For more advanced usage and examples, please refer to the [documentation](docs/usage.md). Runnable low-cost examples are also available in [`examples/`](examples).
80
120
 
81
121
  ## Key Features
82
122
 
83
123
  - **🔍 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.
84
124
 
85
- - **⚡ 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.
125
+ - **⚡ 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.
86
126
 
87
127
  - **🧠 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.
88
128
 
89
129
  - **📚 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.
90
130
 
91
- - **🚀 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.
131
+ - **🚀 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.
92
132
 
93
- - **🔧 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.
133
+ - **🔧 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.
94
134
 
95
135
  - **🔒 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.
96
136
 
@@ -122,7 +162,7 @@ Our vision is to become a pivotal module in the future of AI-driven development
122
162
 
123
163
  ### Roadmap
124
164
 
125
- For a detailed view of our project roadmap, please visit our [Project Roadmap](https://github.com/users/JetXu-LLM/projects/2).
165
+ For a historical view of the earlier roadmap, please visit [Vision and Roadmap](VISION_AND_ROADMAP.md).
126
166
 
127
167
  ## Acknowledgments
128
168
 
@@ -148,150 +188,3 @@ If you have any questions, suggestions, or feedback, please feel free to reach o
148
188
  ---
149
189
 
150
190
  Thank you for choosing llama-github! We hope this library enhances your AI development experience and helps you build powerful applications with ease.
151
-
152
- # Changelog
153
-
154
- All notable changes to this project will be documented in this file.
155
-
156
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
157
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
158
-
159
- ## [0.3.2] - 2025-06-23
160
-
161
- ### Optimized
162
- - Upgrade to extract_related_issues method
163
-
164
- ## [0.3.1] - 2025-05-25
165
-
166
- ### Optimized
167
- - Upgrade to mistral medium & devstral small
168
-
169
- ## [0.2.8] - 2025-03-19
170
-
171
- ### Optimized
172
- - Upgrade to mistral-small-latest
173
-
174
- ## [0.2.3] - 2024-11-24
175
-
176
- ### Optimized
177
- - Upgrade to mistral-large-2411
178
-
179
- ## [0.2.2] - 2024-11-19
180
-
181
- ### Optimized
182
- - more precise model specification (stick to mistral-large-2407 and mistral-nemo-latest)
183
-
184
- ## [0.2.1] - 2024-11-16
185
-
186
- ### Optimized
187
- - approperately handle more file types when calculate file changes in PR
188
-
189
- ## [0.2.0] - 2024-11-16
190
-
191
- ### Optimized
192
- - fix bugs for generate repo from pool by using Github_install_id
193
-
194
- ## [0.1.9] - 2024-11-04
195
-
196
- ### Optimized
197
- - fix bugs for get pr content
198
-
199
- ## [0.1.8] - 2024-11-03
200
-
201
- ### Optimized
202
- - fix bugs for get pr content file diff calculate logic
203
-
204
- ## [0.1.7] - 2024-10-31
205
-
206
- ### Optimized
207
- - fix bugs for get pr content
208
-
209
- ## [0.1.6] - 2024-10-30
210
-
211
- ### New Features
212
- - Enhanced PR content analysis with detailed commit information extraction
213
- - Improved issue linking detection with support for multiple reference formats
214
- - Full GitHub URLs, #references, and keyword-based references
215
- - Added validation for issue numbers
216
-
217
- ### Improvements
218
- - Added detailed commit metadata extraction including stats and file changes
219
- - Enhanced error handling for commit fetching
220
-
221
- ## [0.1.5] - 2024-10-14
222
-
223
- ### Optimized
224
- - requirements.txt updated to more precise list
225
-
226
- ## [0.1.4] - 2024-10-14
227
-
228
- ### Improved
229
- - Optimized `simple_mode`:
230
- - Removed dependencies on `Torch` and `Transformers` libraries
231
- - Reduced memory footprint
232
- - Eliminated related imports
233
- - Enhanced compatibility with AWS Lambda environment
234
-
235
- ## [0.1.3] - 2024-10-14
236
-
237
- ### Added
238
- - Modified `LLMManager` class to skip loading embedding and reranker models when `simple_mode` is enabled
239
- - Updated `retrieve_context` method to use instance's `simple_mode` by default, with option to override
240
-
241
- ### Improved
242
- - Faster initialization process when `simple_mode` is enabled, skipping embedding and reranker model loading
243
- - More flexible usage of `simple_mode` in `retrieve_context`, allowing per-call customization
244
-
245
- ### Developer Notes
246
- - When using `simple_mode=True` during GithubRAG initialization, be aware that embedding and reranking functionalities will not be available
247
- - The `retrieve_context` method now uses a late binding approach for `simple_mode` parameter
248
-
249
- ## [0.1.2] - 2024-10-09
250
-
251
- ### Added
252
- - New `get_pr_content` method in `Repository` class for comprehensive PR data retrieval
253
- - Singleton pattern implementation for efficient PR data caching
254
- - Support for LLM-assisted PR analysis and Q&A capabilities
255
- - Automatic caching mechanism to reduce API calls and improve performance
256
- - Threaded comment and review retrieval functionality
257
-
258
- ### Changed
259
- - Improved PR data fetching process to include metadata, file changes, and comments
260
-
261
- ### Optimized
262
- - Reduced API calls through intelligent caching of PR data
263
-
264
- ### Developer Notes
265
- - First call to `get_pr_content` fetches data from GitHub API, subsequent calls use cached data
266
- - Cache automatically refreshes when PR is updated
267
-
268
- ## [0.1.1] - 2024-08-23
269
-
270
- ### Added
271
- - Implemented `answer_with_context` method for direct answer generation (closes #6)
272
- - Added support for Mistral AI LLM provider
273
- - Enhanced `retrieve_context` function to include metadata (e.g., URLs) with each context string (closes #2)
274
-
275
- ### Changed
276
- - Improved reranking with jina-reranker-v2 for better context retrieval
277
- - Updated return type of `retrieve_context` to accommodate metadata
278
-
279
- ### Fixed
280
- - Resolved warning during context retrieval (closes #3)
281
-
282
- ### Improved
283
- - Enhanced overall context retrieval process
284
- - Expanded LLM support for more versatile use cases
285
-
286
- ## [0.1.0] - 2024-08-15
287
-
288
- ### Added
289
- - Initial release of llama-github
290
- - Basic functionality for retrieving context from GitHub repositories
291
- - Integration with LLM for processing and generating responses
292
-
293
- [0.1.4]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.3...v0.1.4
294
- [0.1.3]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.2...v0.1.3
295
- [0.1.2]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.1...v0.1.2
296
- [0.1.1]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.0...v0.1.1
297
- [0.1.0]: https://github.com/JetXu-LLM/llama-github/releases/tag/v0.1.0
@@ -1,3 +1,34 @@
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
+ </div>
28
+ </div>
29
+ </details>
30
+ </div>
31
+
1
32
  # llama-github
2
33
 
3
34
  [Detail Document] https://deepwiki.com/JetXu-LLM/llama-github
@@ -18,6 +49,8 @@ If you like this project or believe it has potential, please give it a ⭐️. Y
18
49
  pip install llama-github
19
50
  ```
20
51
 
52
+ Current maintained runtime target: Python `3.10+`.
53
+
21
54
  ## Usage
22
55
 
23
56
  Here's a simple example of how to use llama-github:
@@ -34,29 +67,32 @@ github_rag = GithubRAG(
34
67
 
35
68
  # Retrieve context for a coding question (simple_mode is default set to False)
36
69
  query = "How to create a NumPy array in Python?"
37
- context = github_rag.retrieve_context(
38
- 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
70
+ contexts = github_rag.retrieve_context(
71
+ query,
39
72
  # simple_mode = True
40
73
  )
41
74
 
42
- print(context)
75
+ print(contexts[0]["url"])
76
+ print(contexts[0]["context"])
43
77
  ```
44
78
 
45
- For more advanced usage and examples, please refer to the [documentation](docs/usage.md).
79
+ `retrieve_context()` returns a list of context dictionaries. Each item contains at least `context` and `url`.
80
+
81
+ For more advanced usage and examples, please refer to the [documentation](docs/usage.md). Runnable low-cost examples are also available in [`examples/`](examples).
46
82
 
47
83
  ## Key Features
48
84
 
49
85
  - **🔍 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.
50
86
 
51
- - **⚡ 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.
87
+ - **⚡ 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.
52
88
 
53
89
  - **🧠 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.
54
90
 
55
91
  - **📚 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.
56
92
 
57
- - **🚀 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.
93
+ - **🚀 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.
58
94
 
59
- - **🔧 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.
95
+ - **🔧 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.
60
96
 
61
97
  - **🔒 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.
62
98
 
@@ -88,7 +124,7 @@ Our vision is to become a pivotal module in the future of AI-driven development
88
124
 
89
125
  ### Roadmap
90
126
 
91
- For a detailed view of our project roadmap, please visit our [Project Roadmap](https://github.com/users/JetXu-LLM/projects/2).
127
+ For a historical view of the earlier roadmap, please visit [Vision and Roadmap](VISION_AND_ROADMAP.md).
92
128
 
93
129
  ## Acknowledgments
94
130
 
@@ -5,6 +5,10 @@
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",
9
13
  "default_reranker": "jinaai/jina-reranker-v2-base-multilingual",
10
14
  "min_stars_to_keep_result": 20,
@@ -17,4 +21,4 @@
17
21
  "repo_chunk_size": 7000,
18
22
  "google_chunk_size": 7000,
19
23
  "top_n_contexts": 4
20
- }
24
+ }
@@ -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()