llama-github 0.3.3__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.3 → llama_github-0.4.0}/CHANGELOG.md +12 -0
  2. {llama_github-0.3.3/llama_github.egg-info → llama_github-0.4.0}/PKG-INFO +42 -186
  3. {llama_github-0.3.3 → llama_github-0.4.0}/README.md +42 -38
  4. {llama_github-0.3.3 → llama_github-0.4.0}/llama_github/config/config.json +5 -1
  5. {llama_github-0.3.3 → 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.3 → 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.3 → llama_github-0.4.0}/llama_github/utils.py +25 -33
  15. llama_github-0.4.0/llama_github/version.py +1 -0
  16. {llama_github-0.3.3 → llama_github-0.4.0/llama_github.egg-info}/PKG-INFO +42 -186
  17. {llama_github-0.3.3 → 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.3/llama_github/data_retrieval/github_api.py +0 -317
  31. llama_github-0.3.3/llama_github/features/feature_flags.py +0 -0
  32. llama_github-0.3.3/llama_github/features/insider_features.py +0 -0
  33. llama_github-0.3.3/llama_github/github_integration/github_auth_manager.py +0 -345
  34. llama_github-0.3.3/llama_github/github_rag.py +0 -523
  35. llama_github-0.3.3/llama_github/llm_integration/initial_load.py +0 -179
  36. llama_github-0.3.3/llama_github/llm_integration/llm_handler.py +0 -129
  37. llama_github-0.3.3/llama_github/logger.py +0 -15
  38. llama_github-0.3.3/llama_github/rag_processing/__init__.py +0 -0
  39. llama_github-0.3.3/llama_github/rag_processing/rag_processor.py +0 -500
  40. llama_github-0.3.3/llama_github/version.py +0 -1
  41. llama_github-0.3.3/llama_github.egg-info/requires.txt +0 -19
  42. llama_github-0.3.3/setup.cfg +0 -37
  43. llama_github-0.3.3/setup.py +0 -16
  44. llama_github-0.3.3/tests/test_data_retrieval.py +0 -0
  45. llama_github-0.3.3/tests/test_github_auth_manager.py +0 -0
  46. llama_github-0.3.3/tests/test_initial_load.py +0 -0
  47. llama_github-0.3.3/tests/test_llm_handler.py +0 -0
  48. llama_github-0.3.3/tests/test_logger.py +0 -0
  49. llama_github-0.3.3/tests/test_rag_processor.py +0 -0
  50. {llama_github-0.3.3 → llama_github-0.4.0}/LICENSE +0 -0
  51. {llama_github-0.3.3 → llama_github-0.4.0}/MANIFEST.in +0 -0
  52. {llama_github-0.3.3 → llama_github-0.4.0}/llama_github/__init__.py +0 -0
  53. {llama_github-0.3.3 → llama_github-0.4.0}/llama_github/config/__init__.py +0 -0
  54. {llama_github-0.3.3 → llama_github-0.4.0}/llama_github/data_retrieval/__init__.py +0 -0
  55. {llama_github-0.3.3 → llama_github-0.4.0}/llama_github/github_integration/__init__.py +0 -0
  56. {llama_github-0.3.3/llama_github/features → llama_github-0.4.0/llama_github/llm_integration}/__init__.py +0 -0
  57. {llama_github-0.3.3/llama_github/llm_integration → llama_github-0.4.0/llama_github/rag_processing}/__init__.py +0 -0
  58. {llama_github-0.3.3 → llama_github-0.4.0}/llama_github.egg-info/dependency_links.txt +0 -0
  59. {llama_github-0.3.3 → llama_github-0.4.0}/llama_github.egg-info/top_level.txt +0 -0
@@ -5,6 +5,18 @@ 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
+
8
20
  ## [0.3.3] - 2025-08-24
9
21
 
10
22
  ### Optimized
@@ -1,36 +1,40 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llama-github
3
- Version: 0.3.3
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
34
38
 
35
39
 
36
40
  <div align="right">
@@ -58,7 +62,6 @@ Dynamic: requires-dist
58
62
  | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=tr">Türkçe</a>
59
63
  | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=vi">Tiếng Việt</a>
60
64
  | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=id">Bahasa Indonesia</a>
61
- | <a href="https://openaitx.github.io/view.html?user=JetXu-LLM&project=llama-github&lang=as">অসমীয়া</
62
65
  </div>
63
66
  </div>
64
67
  </details>
@@ -84,6 +87,8 @@ If you like this project or believe it has potential, please give it a ⭐️. Y
84
87
  pip install llama-github
85
88
  ```
86
89
 
90
+ Current maintained runtime target: Python `3.10+`.
91
+
87
92
  ## Usage
88
93
 
89
94
  Here's a simple example of how to use llama-github:
@@ -100,29 +105,32 @@ github_rag = GithubRAG(
100
105
 
101
106
  # Retrieve context for a coding question (simple_mode is default set to False)
102
107
  query = "How to create a NumPy array in Python?"
103
- context = github_rag.retrieve_context(
104
- 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,
105
110
  # simple_mode = True
106
111
  )
107
112
 
108
- print(context)
113
+ print(contexts[0]["url"])
114
+ print(contexts[0]["context"])
109
115
  ```
110
116
 
111
- 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).
112
120
 
113
121
  ## Key Features
114
122
 
115
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.
116
124
 
117
- - **⚡ 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.
118
126
 
119
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.
120
128
 
121
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.
122
130
 
123
- - **🚀 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.
124
132
 
125
- - **🔧 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.
126
134
 
127
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.
128
136
 
@@ -154,7 +162,7 @@ Our vision is to become a pivotal module in the future of AI-driven development
154
162
 
155
163
  ### Roadmap
156
164
 
157
- 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).
158
166
 
159
167
  ## Acknowledgments
160
168
 
@@ -180,155 +188,3 @@ If you have any questions, suggestions, or feedback, please feel free to reach o
180
188
  ---
181
189
 
182
190
  Thank you for choosing llama-github! We hope this library enhances your AI development experience and helps you build powerful applications with ease.
183
-
184
- # Changelog
185
-
186
- All notable changes to this project will be documented in this file.
187
-
188
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
189
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
190
-
191
- ## [0.3.3] - 2025-08-24
192
-
193
- ### Optimized
194
- - Enhance diff hunk header
195
-
196
- ## [0.3.2] - 2025-06-23
197
-
198
- ### Optimized
199
- - Upgrade to extract_related_issues method
200
-
201
- ## [0.3.1] - 2025-05-25
202
-
203
- ### Optimized
204
- - Upgrade to mistral medium & devstral small
205
-
206
- ## [0.2.8] - 2025-03-19
207
-
208
- ### Optimized
209
- - Upgrade to mistral-small-latest
210
-
211
- ## [0.2.3] - 2024-11-24
212
-
213
- ### Optimized
214
- - Upgrade to mistral-large-2411
215
-
216
- ## [0.2.2] - 2024-11-19
217
-
218
- ### Optimized
219
- - more precise model specification (stick to mistral-large-2407 and mistral-nemo-latest)
220
-
221
- ## [0.2.1] - 2024-11-16
222
-
223
- ### Optimized
224
- - approperately handle more file types when calculate file changes in PR
225
-
226
- ## [0.2.0] - 2024-11-16
227
-
228
- ### Optimized
229
- - fix bugs for generate repo from pool by using Github_install_id
230
-
231
- ## [0.1.9] - 2024-11-04
232
-
233
- ### Optimized
234
- - fix bugs for get pr content
235
-
236
- ## [0.1.8] - 2024-11-03
237
-
238
- ### Optimized
239
- - fix bugs for get pr content file diff calculate logic
240
-
241
- ## [0.1.7] - 2024-10-31
242
-
243
- ### Optimized
244
- - fix bugs for get pr content
245
-
246
- ## [0.1.6] - 2024-10-30
247
-
248
- ### New Features
249
- - Enhanced PR content analysis with detailed commit information extraction
250
- - Improved issue linking detection with support for multiple reference formats
251
- - Full GitHub URLs, #references, and keyword-based references
252
- - Added validation for issue numbers
253
-
254
- ### Improvements
255
- - Added detailed commit metadata extraction including stats and file changes
256
- - Enhanced error handling for commit fetching
257
-
258
- ## [0.1.5] - 2024-10-14
259
-
260
- ### Optimized
261
- - requirements.txt updated to more precise list
262
-
263
- ## [0.1.4] - 2024-10-14
264
-
265
- ### Improved
266
- - Optimized `simple_mode`:
267
- - Removed dependencies on `Torch` and `Transformers` libraries
268
- - Reduced memory footprint
269
- - Eliminated related imports
270
- - Enhanced compatibility with AWS Lambda environment
271
-
272
- ## [0.1.3] - 2024-10-14
273
-
274
- ### Added
275
- - Modified `LLMManager` class to skip loading embedding and reranker models when `simple_mode` is enabled
276
- - Updated `retrieve_context` method to use instance's `simple_mode` by default, with option to override
277
-
278
- ### Improved
279
- - Faster initialization process when `simple_mode` is enabled, skipping embedding and reranker model loading
280
- - More flexible usage of `simple_mode` in `retrieve_context`, allowing per-call customization
281
-
282
- ### Developer Notes
283
- - When using `simple_mode=True` during GithubRAG initialization, be aware that embedding and reranking functionalities will not be available
284
- - The `retrieve_context` method now uses a late binding approach for `simple_mode` parameter
285
-
286
- ## [0.1.2] - 2024-10-09
287
-
288
- ### Added
289
- - New `get_pr_content` method in `Repository` class for comprehensive PR data retrieval
290
- - Singleton pattern implementation for efficient PR data caching
291
- - Support for LLM-assisted PR analysis and Q&A capabilities
292
- - Automatic caching mechanism to reduce API calls and improve performance
293
- - Threaded comment and review retrieval functionality
294
-
295
- ### Changed
296
- - Improved PR data fetching process to include metadata, file changes, and comments
297
-
298
- ### Optimized
299
- - Reduced API calls through intelligent caching of PR data
300
-
301
- ### Developer Notes
302
- - First call to `get_pr_content` fetches data from GitHub API, subsequent calls use cached data
303
- - Cache automatically refreshes when PR is updated
304
-
305
- ## [0.1.1] - 2024-08-23
306
-
307
- ### Added
308
- - Implemented `answer_with_context` method for direct answer generation (closes #6)
309
- - Added support for Mistral AI LLM provider
310
- - Enhanced `retrieve_context` function to include metadata (e.g., URLs) with each context string (closes #2)
311
-
312
- ### Changed
313
- - Improved reranking with jina-reranker-v2 for better context retrieval
314
- - Updated return type of `retrieve_context` to accommodate metadata
315
-
316
- ### Fixed
317
- - Resolved warning during context retrieval (closes #3)
318
-
319
- ### Improved
320
- - Enhanced overall context retrieval process
321
- - Expanded LLM support for more versatile use cases
322
-
323
- ## [0.1.0] - 2024-08-15
324
-
325
- ### Added
326
- - Initial release of llama-github
327
- - Basic functionality for retrieving context from GitHub repositories
328
- - Integration with LLM for processing and generating responses
329
-
330
- [0.1.4]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.3...v0.1.4
331
- [0.1.3]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.2...v0.1.3
332
- [0.1.2]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.1...v0.1.2
333
- [0.1.1]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.0...v0.1.1
334
- [0.1.0]: https://github.com/JetXu-LLM/llama-github/releases/tag/v0.1.0
@@ -1,33 +1,32 @@
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>
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>
31
30
  </div>
32
31
 
33
32
  # llama-github
@@ -50,6 +49,8 @@ If you like this project or believe it has potential, please give it a ⭐️. Y
50
49
  pip install llama-github
51
50
  ```
52
51
 
52
+ Current maintained runtime target: Python `3.10+`.
53
+
53
54
  ## Usage
54
55
 
55
56
  Here's a simple example of how to use llama-github:
@@ -66,29 +67,32 @@ github_rag = GithubRAG(
66
67
 
67
68
  # Retrieve context for a coding question (simple_mode is default set to False)
68
69
  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
70
+ contexts = github_rag.retrieve_context(
71
+ query,
71
72
  # simple_mode = True
72
73
  )
73
74
 
74
- print(context)
75
+ print(contexts[0]["url"])
76
+ print(contexts[0]["context"])
75
77
  ```
76
78
 
77
- 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).
78
82
 
79
83
  ## Key Features
80
84
 
81
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.
82
86
 
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.
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.
84
88
 
85
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.
86
90
 
87
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.
88
92
 
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.
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.
90
94
 
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.
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.
92
96
 
93
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.
94
98
 
@@ -120,7 +124,7 @@ Our vision is to become a pivotal module in the future of AI-driven development
120
124
 
121
125
  ### Roadmap
122
126
 
123
- 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).
124
128
 
125
129
  ## Acknowledgments
126
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()