llama-github 0.1.0__tar.gz → 0.1.2__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 (44) hide show
  1. llama_github-0.1.2/CHANGELOG.md +53 -0
  2. llama_github-0.1.2/MANIFEST.in +2 -0
  3. {llama_github-0.1.0 → llama_github-0.1.2}/PKG-INFO +84 -3
  4. llama_github-0.1.0/llama_github.egg-info/PKG-INFO → llama_github-0.1.2/README.md +29 -31
  5. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/config/config.json +3 -3
  6. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/data_retrieval/github_api.py +21 -0
  7. llama_github-0.1.2/llama_github/data_retrieval/github_entities.py +578 -0
  8. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/github_integration/github_auth_manager.py +79 -0
  9. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/github_rag.py +69 -11
  10. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/llm_integration/initial_load.py +8 -1
  11. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/llm_integration/llm_handler.py +2 -4
  12. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/rag_processing/rag_processor.py +76 -66
  13. llama_github-0.1.2/llama_github/utils.py +307 -0
  14. llama_github-0.1.2/llama_github/version.py +1 -0
  15. llama_github-0.1.2/llama_github.egg-info/PKG-INFO +181 -0
  16. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github.egg-info/SOURCES.txt +1 -0
  17. {llama_github-0.1.0 → llama_github-0.1.2}/setup.cfg +2 -2
  18. {llama_github-0.1.0 → llama_github-0.1.2}/setup.py +7 -0
  19. llama_github-0.1.0/MANIFEST.in +0 -1
  20. llama_github-0.1.0/README.md +0 -71
  21. llama_github-0.1.0/llama_github/data_retrieval/github_entities.py +0 -301
  22. llama_github-0.1.0/llama_github/utils.py +0 -98
  23. llama_github-0.1.0/llama_github/version.py +0 -1
  24. {llama_github-0.1.0 → llama_github-0.1.2}/LICENSE +0 -0
  25. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/__init__.py +0 -0
  26. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/config/__init__.py +0 -0
  27. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/config/config.py +0 -0
  28. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/data_retrieval/__init__.py +0 -0
  29. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/features/__init__.py +0 -0
  30. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/features/feature_flags.py +0 -0
  31. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/features/insider_features.py +0 -0
  32. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/github_integration/__init__.py +0 -0
  33. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/llm_integration/__init__.py +0 -0
  34. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/logger.py +0 -0
  35. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github/rag_processing/__init__.py +0 -0
  36. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github.egg-info/dependency_links.txt +0 -0
  37. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github.egg-info/requires.txt +0 -0
  38. {llama_github-0.1.0 → llama_github-0.1.2}/llama_github.egg-info/top_level.txt +0 -0
  39. {llama_github-0.1.0 → llama_github-0.1.2}/tests/test_data_retrieval.py +0 -0
  40. {llama_github-0.1.0 → llama_github-0.1.2}/tests/test_github_auth_manager.py +0 -0
  41. {llama_github-0.1.0 → llama_github-0.1.2}/tests/test_initial_load.py +0 -0
  42. {llama_github-0.1.0 → llama_github-0.1.2}/tests/test_llm_handler.py +0 -0
  43. {llama_github-0.1.0 → llama_github-0.1.2}/tests/test_logger.py +0 -0
  44. {llama_github-0.1.0 → llama_github-0.1.2}/tests/test_rag_processor.py +0 -0
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.2] - 2024-10-09
9
+
10
+ ### Added
11
+ - New `get_pr_content` method in `Repository` class for comprehensive PR data retrieval
12
+ - Singleton pattern implementation for efficient PR data caching
13
+ - Support for LLM-assisted PR analysis and Q&A capabilities
14
+ - Automatic caching mechanism to reduce API calls and improve performance
15
+ - Threaded comment and review retrieval functionality
16
+
17
+ ### Changed
18
+ - Improved PR data fetching process to include metadata, file changes, and comments
19
+
20
+ ### Optimized
21
+ - Reduced API calls through intelligent caching of PR data
22
+
23
+ ### Developer Notes
24
+ - First call to `get_pr_content` fetches data from GitHub API, subsequent calls use cached data
25
+ - Cache automatically refreshes when PR is updated
26
+
27
+ ## [0.1.1] - 2024-08-23
28
+
29
+ ### Added
30
+ - Implemented `answer_with_context` method for direct answer generation (closes #6)
31
+ - Added support for Mistral AI LLM provider
32
+ - Enhanced `retrieve_context` function to include metadata (e.g., URLs) with each context string (closes #2)
33
+
34
+ ### Changed
35
+ - Improved reranking with jina-reranker-v2 for better context retrieval
36
+ - Updated return type of `retrieve_context` to accommodate metadata
37
+
38
+ ### Fixed
39
+ - Resolved warning during context retrieval (closes #3)
40
+
41
+ ### Improved
42
+ - Enhanced overall context retrieval process
43
+ - Expanded LLM support for more versatile use cases
44
+
45
+ ## [0.1.0] - 2024-08-15
46
+
47
+ ### Added
48
+ - Initial release of llama-github
49
+ - Basic functionality for retrieving context from GitHub repositories
50
+ - Integration with LLM for processing and generating responses
51
+
52
+ [0.1.1]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.0...v0.1.1
53
+ [0.1.0]: https://github.com/JetXu-LLM/llama-github/releases/tag/v0.1.0
@@ -0,0 +1,2 @@
1
+ include llama_github/config/config.json
2
+ include CHANGELOG.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-github
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
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
5
  Home-page: https://github.com/JetXu-LLM/llama-github
6
6
  Author: Jet Xu
@@ -29,9 +29,16 @@ Requires-Dist: flake8; extra == "dev"
29
29
 
30
30
  # llama-github
31
31
 
32
+ [![PyPI version](https://badge.fury.io/py/llama-github.svg)](https://badge.fury.io/py/llama-github)
33
+ [![Downloads](https://static.pepy.tech/badge/Llama-github)](https://pepy.tech/project/Llama-github)
32
34
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
33
35
 
34
- 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 contents (Repository, Issue, Code). It Augments through LLMs and Generates context for any coding question, in order to streamline the development of sophisticated AI-driven applications.
36
+ Llama-github is a powerful tool that helps you retrieve 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.
37
+
38
+ If you like this project or believe it has potential, please give it a ⭐️. Your support is our greatest motivation!
39
+
40
+ ## Architecture
41
+ ![High Level Architecture](./docs/high_level_architecture.drawio.svg)
35
42
 
36
43
  ## Installation
37
44
  ```
@@ -82,6 +89,26 @@ For more advanced usage and examples, please refer to the [documentation](docs/u
82
89
 
83
90
  - **🛠️ 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.
84
91
 
92
+ ## Vision and Roadmap
93
+
94
+ ### Vision
95
+
96
+ 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.
97
+
98
+ ![Vision Architecture](./docs/vision.drawio.svg)
99
+
100
+ ### Roadmap
101
+
102
+ For a detailed view of our project roadmap, please visit our [Project Roadmap](https://github.com/users/JetXu-LLM/projects/2).
103
+
104
+ ## Acknowledgments
105
+
106
+ We would like to express our gratitude to the following open-source projects for their support and contributions:
107
+
108
+ - **[LangChain](https://github.com/langchain-ai/langchain)**: For providing the foundational framework that empowers the LLM prompting and processing capabilities in llama-github.
109
+ - **[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.
110
+
111
+ Their contributions have been instrumental in the development of llama-github, and we highly recommend checking out their projects for more innovative solutions.
85
112
 
86
113
  ## Contributing
87
114
 
@@ -93,8 +120,62 @@ This project is licensed under the terms of the Apache 2.0 license. See the [LIC
93
120
 
94
121
  ## Contact
95
122
 
96
- If you have any questions, suggestions, or feedback, please feel free to reach out to us at [Voldemort.xu@foxmail.com](mailto:Voldemort.xu@foxmail.com).
123
+ 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).
97
124
 
98
125
  ---
99
126
 
100
127
  Thank you for choosing llama-github! We hope this library enhances your AI development experience and helps you build powerful applications with ease.
128
+
129
+ # Changelog
130
+
131
+ All notable changes to this project will be documented in this file.
132
+
133
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
134
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
135
+
136
+ ## [0.1.2] - 2024-10-09
137
+
138
+ ### Added
139
+ - New `get_pr_content` method in `Repository` class for comprehensive PR data retrieval
140
+ - Singleton pattern implementation for efficient PR data caching
141
+ - Support for LLM-assisted PR analysis and Q&A capabilities
142
+ - Automatic caching mechanism to reduce API calls and improve performance
143
+ - Threaded comment and review retrieval functionality
144
+
145
+ ### Changed
146
+ - Improved PR data fetching process to include metadata, file changes, and comments
147
+
148
+ ### Optimized
149
+ - Reduced API calls through intelligent caching of PR data
150
+
151
+ ### Developer Notes
152
+ - First call to `get_pr_content` fetches data from GitHub API, subsequent calls use cached data
153
+ - Cache automatically refreshes when PR is updated
154
+
155
+ ## [0.1.1] - 2024-08-23
156
+
157
+ ### Added
158
+ - Implemented `answer_with_context` method for direct answer generation (closes #6)
159
+ - Added support for Mistral AI LLM provider
160
+ - Enhanced `retrieve_context` function to include metadata (e.g., URLs) with each context string (closes #2)
161
+
162
+ ### Changed
163
+ - Improved reranking with jina-reranker-v2 for better context retrieval
164
+ - Updated return type of `retrieve_context` to accommodate metadata
165
+
166
+ ### Fixed
167
+ - Resolved warning during context retrieval (closes #3)
168
+
169
+ ### Improved
170
+ - Enhanced overall context retrieval process
171
+ - Expanded LLM support for more versatile use cases
172
+
173
+ ## [0.1.0] - 2024-08-15
174
+
175
+ ### Added
176
+ - Initial release of llama-github
177
+ - Basic functionality for retrieving context from GitHub repositories
178
+ - Integration with LLM for processing and generating responses
179
+
180
+ [0.1.1]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.0...v0.1.1
181
+ [0.1.0]: https://github.com/JetXu-LLM/llama-github/releases/tag/v0.1.0
@@ -1,37 +1,15 @@
1
- Metadata-Version: 2.1
2
- Name: llama-github
3
- Version: 0.1.0
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
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.6
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: aiohttp
15
- Requires-Dist: asyncio
16
- Requires-Dist: dataclasses
17
- Requires-Dist: PyGithub
18
- Requires-Dist: langchain
19
- Requires-Dist: numpy
20
- Requires-Dist: pydantic
21
- Requires-Dist: requests
22
- Requires-Dist: torch
23
- Requires-Dist: transformers
24
- Requires-Dist: urllib3
25
- Provides-Extra: dev
26
- Requires-Dist: pytest; extra == "dev"
27
- Requires-Dist: black; extra == "dev"
28
- Requires-Dist: flake8; extra == "dev"
29
-
30
1
  # llama-github
31
2
 
3
+ [![PyPI version](https://badge.fury.io/py/llama-github.svg)](https://badge.fury.io/py/llama-github)
4
+ [![Downloads](https://static.pepy.tech/badge/Llama-github)](https://pepy.tech/project/Llama-github)
32
5
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
33
6
 
34
- 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 contents (Repository, Issue, Code). It Augments through LLMs and Generates context for any coding question, in order to streamline the development of sophisticated AI-driven applications.
7
+ Llama-github is a powerful tool that helps you retrieve 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.
8
+
9
+ If you like this project or believe it has potential, please give it a ⭐️. Your support is our greatest motivation!
10
+
11
+ ## Architecture
12
+ ![High Level Architecture](./docs/high_level_architecture.drawio.svg)
35
13
 
36
14
  ## Installation
37
15
  ```
@@ -82,6 +60,26 @@ For more advanced usage and examples, please refer to the [documentation](docs/u
82
60
 
83
61
  - **🛠️ 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.
84
62
 
63
+ ## Vision and Roadmap
64
+
65
+ ### Vision
66
+
67
+ 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.
68
+
69
+ ![Vision Architecture](./docs/vision.drawio.svg)
70
+
71
+ ### Roadmap
72
+
73
+ For a detailed view of our project roadmap, please visit our [Project Roadmap](https://github.com/users/JetXu-LLM/projects/2).
74
+
75
+ ## Acknowledgments
76
+
77
+ We would like to express our gratitude to the following open-source projects for their support and contributions:
78
+
79
+ - **[LangChain](https://github.com/langchain-ai/langchain)**: For providing the foundational framework that empowers the LLM prompting and processing capabilities in llama-github.
80
+ - **[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.
81
+
82
+ Their contributions have been instrumental in the development of llama-github, and we highly recommend checking out their projects for more innovative solutions.
85
83
 
86
84
  ## Contributing
87
85
 
@@ -93,7 +91,7 @@ This project is licensed under the terms of the Apache 2.0 license. See the [LIC
93
91
 
94
92
  ## Contact
95
93
 
96
- If you have any questions, suggestions, or feedback, please feel free to reach out to us at [Voldemort.xu@foxmail.com](mailto:Voldemort.xu@foxmail.com).
94
+ 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).
97
95
 
98
96
  ---
99
97
 
@@ -1,12 +1,12 @@
1
1
  {
2
- "general_prompt": "You are a highly intelligent assistant with expertise in GitHub repositories and coding practices. Your task is to analyze questions related to GitHub projects, coding issues, or programming concepts. Using your extensive knowledge base, you will provide detailed, accurate, and contextually relevant answers. You have the ability to understand complex coding queries, retrieve pertinent information from GitHub repositories, and augment this data with your advanced reasoning capabilities. Your responses should guide developers towards solving their problems, understanding new concepts, or finding the information they seek related to GitHub projects and software development.",
2
+ "general_prompt": "You are a highly intelligent assistant with expertise in GitHub repositories and coding practices. Your primary task is to provide comprehensive and accurate answers to questions related to GitHub projects, coding issues, or programming concepts. When analyzing queries, focus on delivering a complete response that directly addresses the original question. While you may be provided with additional context, use this information judiciously to enhance your answer without deviating from the main point. Your extensive knowledge base, combined with your ability to understand complex coding queries and retrieve pertinent information, should be the foundation of your responses. When referencing provided context, integrate it seamlessly into your answer without explicitly evaluating or critiquing it. Your goal is to guide developers towards solutions, explain concepts clearly, or provide the information they seek about GitHub projects and software development, always ensuring that your final response is a cohesive and complete answer to the original question.",
3
3
  "always_answer_prompt": "**Instructions:**\nAs an advanced AI assistant with deep expertise in GitHub repositories, coding practices, and programming concepts, your primary goal is to provide concise, accurate, and contextually relevant answers to complex coding queries. When presented with a question, your first step is to analyze the query and generate a succinct abstraction that captures its core essence by using only one sentence, especially if the original question is lengthy or convoluted.\n\nNext, leverage your extensive knowledge base and reasoning capabilities to craft a coherent and informative response. If possible, enhance your answer with sample code snippets that demonstrate the practical application of the concepts discussed. Remember, your responses should guide developers towards solving their problems, understanding new concepts, or finding the information they seek related to GitHub projects and software development. Please keep your responses concise and to the point, focusing on the most essential information needed to address the query. Avoid generating long articles or overly detailed explanations.\n\nIn addition to the answer itself, provide a brief analysis of how you would approach searching for relevant code and issues within GitHub repositories. This analysis should outline your thought process and the key factors you would consider when conducting these searches. However, keep this analysis concise and focused on the high-level logic rather than delving into specific search criteria or keywords.\n\nThroughout your responses, prioritize clarity and brevity. Focus on delivering the most essential information needed to address the query effectively. Even if certain details are unknown, ensure that your answers are plausible, useful, and serve as a foundation for further exploration and context generation.\n\nRemember, your ultimate aim is to empower developers with the knowledge and guidance they need to overcome challenges, expand their understanding, and navigate the vast landscape of GitHub repositories and software development practices.",
4
4
  "code_search_criteria_prompt": "**Instructions:**\n- **Expertise-Driven Github Code Search Criteria Generation:** Generate GitHub code search criteria strings based on the provided question and its draft answer. Analyze both the question and answer to identify key concepts, technologies, and coding practices that can help locate relevant code snippets on GitHub. Always include the `language:` qualifier to focus your search on language-related content.\n\n**Output Format:** Present each search criteria string on a new line, formatted for immediate use in GitHub's code search, without additional explanations or commentary.\n\n**Optimization Considerations:**\n- **Keyword Relevance:** Extract keywords and phrases tightly related to the question from the question and answer that are likely to appear in relevant code and code comments. Prioritize terms that reflect specific coding concepts, libraries, or techniques. Avoid generic terms like \"example\" or \"integration\" that may not be present in actual code.\n- **Contextual Understanding:** Use the provided answer as additional context to inform your keyword selection. Identify key insights, technologies, or approaches mentioned in the answer tightly related to the question that can help refine the search criteria.\n- **Language and Platform Specificity:** If the question is specific to a certain programming language or platform, ensure to include relevant language or platform-specific keywords, libraries, or frameworks in the search criteria. This helps filter out irrelevant results from other languages or platforms.\n- **Simplicity and Effectiveness:** Craft search criteria with simple and limited keywords which could lead to precise search results to relevant code snippets tightly related to original question. Strike a balance between specificity and breadth to ensure the criteria capture the essential aspects of the question and answer. The search criteria should be neither too narrow that no results are returned, nor too broad that many irrelevant results are included.\n- **Multiple Perspectives:** Generate multiple search criteria strings that approach the question from different angles or emphasize different aspects mentioned in the question and answer. This increases the chances of finding relevant code snippets.",
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
8
  "default_embedding": "jinaai/jina-embeddings-v2-base-code",
9
- "default_reranker": "jinaai/jina-reranker-v1-turbo-en",
9
+ "default_reranker": "jinaai/jina-reranker-v2-base-multilingual",
10
10
  "min_stars_to_keep_result": 20,
11
11
  "max_workers": 8,
12
12
  "code_search_max_hits": 30,
@@ -16,5 +16,5 @@
16
16
  "issue_chunk_size": 7000,
17
17
  "repo_chunk_size": 7000,
18
18
  "google_chunk_size": 7000,
19
- "top_n_contexts": 5
19
+ "top_n_contexts": 4
20
20
  }
@@ -5,6 +5,7 @@ from llama_github.logger import logger
5
5
  from llama_github.github_integration.github_auth_manager import ExtendedGithub
6
6
  from llama_github.config.config import config
7
7
  import re
8
+ from typing import Any, Dict, List
8
9
 
9
10
 
10
11
  class GitHubAPIHandler:
@@ -81,6 +82,26 @@ class GitHubAPIHandler:
81
82
  file_content = repository_obj.get_file_content(
82
83
  code_search_result['path'])
83
84
  return repository_obj, file_content
85
+
86
+ async def get_pr_files(self, repo: Repository, pr_number: int) -> List[Dict[str, Any]]:
87
+ url = f"{self.base_url}/repos/{repo.full_name}/pulls/{pr_number}/files"
88
+ headers = {"Authorization": f"token {self.token}"}
89
+ async with self.session.get(url, headers=headers) as response:
90
+ if response.status == 200:
91
+ return await response.json()
92
+ else:
93
+ logger.error(f"Failed to get PR files: {response.status}")
94
+ return []
95
+
96
+ async def get_pr_comments(self, repo: Repository, pr_number: int) -> List[Dict[str, Any]]:
97
+ url = f"{self.base_url}/repos/{repo.full_name}/issues/{pr_number}/comments"
98
+ headers = {"Authorization": f"token {self.token}"}
99
+ async with self.session.get(url, headers=headers) as response:
100
+ if response.status == 200:
101
+ return await response.json()
102
+ else:
103
+ logger.error(f"Failed to get PR comments: {response.status}")
104
+ return []
84
105
 
85
106
  def search_code(self, query, repo_full_name=None):
86
107
  """