mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 20:30:41 +08:00
2
MANIFEST.in
Normal file
2
MANIFEST.in
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
recursive-include pr_agent *.toml
|
||||||
|
recursive-exclude pr_agent *.secrets.toml
|
77
README.md
77
README.md
@ -6,7 +6,8 @@
|
|||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://codium.ai/images/pr_agent/logo-dark.png" width="330">
|
<source media="(prefers-color-scheme: dark)" srcset="https://codium.ai/images/pr_agent/logo-dark.png" width="330">
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://codium.ai/images/pr_agent/logo-light.png" width="330">
|
<source media="(prefers-color-scheme: light)" srcset="https://codium.ai/images/pr_agent/logo-light.png" width="330">
|
||||||
<img alt="logo">
|
<img src="https://codium.ai/images/pr_agent/logo-light.png" alt="logo" width="330">
|
||||||
|
|
||||||
</picture>
|
</picture>
|
||||||
<br/>
|
<br/>
|
||||||
Making pull requests less painful with an AI agent
|
Making pull requests less painful with an AI agent
|
||||||
@ -32,16 +33,19 @@ Making pull requests less painful with an AI agent
|
|||||||
|
|
||||||
## News and Updates
|
## News and Updates
|
||||||
|
|
||||||
### Jan 17, 2024
|
### March 24, 2024
|
||||||
|
PR-Agent is now available for easy installation via [pip](https://pr-agent-docs.codium.ai/installation/locally/#using-pip-package).
|
||||||
|
|
||||||
|
### March 17, 2024
|
||||||
- A new feature is now available for the review tool: [`require_can_be_split_review`](https://pr-agent-docs.codium.ai/tools/review/#enabledisable-features).
|
- A new feature is now available for the review tool: [`require_can_be_split_review`](https://pr-agent-docs.codium.ai/tools/review/#enabledisable-features).
|
||||||
If set to true, the tool will add a section that checks if the PR contains several themes, and can be split into smaller PRs.
|
If set to true, the tool will add a section that checks if the PR contains several themes, and can be split into smaller PRs.
|
||||||
|
|
||||||
<kbd><img src="https://codium.ai/images/pr_agent/multiple_pr_themes.png" width="512"></kbd>
|
<kbd><img src="https://codium.ai/images/pr_agent/multiple_pr_themes.png" width="512"></kbd>
|
||||||
|
|
||||||
### Jan 10, 2024
|
### March 10, 2024
|
||||||
- A new [knowledge-base website](https://pr-agent-docs.codium.ai/) for PR-Agent is now available. It includes detailed information about the different tools, usage guides and more, in an accessible and organized format.
|
- A new [knowledge-base website](https://pr-agent-docs.codium.ai/) for PR-Agent is now available. It includes detailed information about the different tools, usage guides and more, in an accessible and organized format.
|
||||||
|
|
||||||
### Jan 8, 2024
|
### March 8, 2024
|
||||||
|
|
||||||
- A new tool, [Find Similar Code](https://pr-agent-docs.codium.ai/tools/similar_code/) 💎 is now available.
|
- A new tool, [Find Similar Code](https://pr-agent-docs.codium.ai/tools/similar_code/) 💎 is now available.
|
||||||
<br>This tool retrieves the most similar code components from inside the organization's codebase, or from open-source code:
|
<br>This tool retrieves the most similar code components from inside the organization's codebase, or from open-source code:
|
||||||
@ -59,7 +63,7 @@ If set to true, the tool will add a section that checks if the PR contains sever
|
|||||||
## Overview
|
## Overview
|
||||||
<div style="text-align:left;">
|
<div style="text-align:left;">
|
||||||
|
|
||||||
CodiumAI PR-Agent is an open-source tool to help efficiently review and handle pull requests.
|
CodiumAI PR-Agent aims to help efficiently review and handle pull requests, by providing AI feedbacks and suggestions
|
||||||
|
|
||||||
- See the [Installation Guide](https://pr-agent-docs.codium.ai/installation/) for instructions on installing and running the tool on different git platforms.
|
- See the [Installation Guide](https://pr-agent-docs.codium.ai/installation/) for instructions on installing and running the tool on different git platforms.
|
||||||
|
|
||||||
@ -71,38 +75,38 @@ Supported commands per platform:
|
|||||||
|
|
||||||
| | | GitHub | Gitlab | Bitbucket | Azure DevOps |
|
| | | GitHub | Gitlab | Bitbucket | Azure DevOps |
|
||||||
|-------|-------------------------------------------------------------------------------------------------------------------|:--------------------:|:--------------------:|:--------------------:|:--------------------:|
|
|-------|-------------------------------------------------------------------------------------------------------------------|:--------------------:|:--------------------:|:--------------------:|:--------------------:|
|
||||||
| TOOLS | Review | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| TOOLS | Review | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | ⮑ Incremental | :white_check_mark: | | | |
|
| | ⮑ Incremental | ✅ | | | |
|
||||||
| | ⮑ [SOC2 Compliance](https://pr-agent-docs.codium.ai/tools/review/#soc2-ticket-compliance) 💎 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | ⮑ [SOC2 Compliance](https://pr-agent-docs.codium.ai/tools/review/#soc2-ticket-compliance) 💎 | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | Describe | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | Describe | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | ⮑ [Inline File Summary](https://pr-agent-docs.codium.ai/tools/describe#inline-file-summary) 💎 | :white_check_mark: | | | |
|
| | ⮑ [Inline File Summary](https://pr-agent-docs.codium.ai/tools/describe#inline-file-summary) 💎 | ✅ | | | |
|
||||||
| | Improve | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | Improve | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | ⮑ Extended | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | ⮑ Extended | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | Ask | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | Ask | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | ⮑ [Ask on code lines](https://pr-agent-docs.codium.ai/tools/ask#ask-lines) | :white_check_mark: | :white_check_mark: | | |
|
| | ⮑ [Ask on code lines](https://pr-agent-docs.codium.ai/tools/ask#ask-lines) | ✅ | ✅ | | |
|
||||||
| | [Custom Suggestions](https://pr-agent-docs.codium.ai/tools/custom_suggestions/) 💎 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | [Custom Suggestions](https://pr-agent-docs.codium.ai/tools/custom_suggestions/) 💎 | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | [Test](https://pr-agent-docs.codium.ai/tools/test/) 💎 | :white_check_mark: | :white_check_mark: | | :white_check_mark: |
|
| | [Test](https://pr-agent-docs.codium.ai/tools/test/) 💎 | ✅ | ✅ | | ✅ |
|
||||||
| | Reflect and Review | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | Reflect and Review | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | Update CHANGELOG.md | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | Update CHANGELOG.md | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | Find Similar Issue | :white_check_mark: | | | |
|
| | Find Similar Issue | ✅ | | | |
|
||||||
| | [Add PR Documentation](https://pr-agent-docs.codium.ai/tools/documentation/) 💎 | :white_check_mark: | :white_check_mark: | | :white_check_mark: |
|
| | [Add PR Documentation](https://pr-agent-docs.codium.ai/tools/documentation/) 💎 | ✅ | ✅ | | ✅ |
|
||||||
| | [Custom Labels](https://pr-agent-docs.codium.ai/tools/custom_labels/) 💎 | :white_check_mark: | :white_check_mark: | | :white_check_mark: |
|
| | [Custom Labels](https://pr-agent-docs.codium.ai/tools/custom_labels/) 💎 | ✅ | ✅ | | ✅ |
|
||||||
| | [Analyze](https://pr-agent-docs.codium.ai/tools/analyze/) 💎 | :white_check_mark: | :white_check_mark: | | :white_check_mark: |
|
| | [Analyze](https://pr-agent-docs.codium.ai/tools/analyze/) 💎 | ✅ | ✅ | | ✅ |
|
||||||
| | [CI Feedback](https://pr-agent-docs.codium.ai/tools/ci_feedback/) 💎 | :white_check_mark: | | | |
|
| | [CI Feedback](https://pr-agent-docs.codium.ai/tools/ci_feedback/) 💎 | ✅ | | | |
|
||||||
| | [Similar Code](https://pr-agent-docs.codium.ai/tools/similar_code/) 💎 | :white_check_mark: | | | |
|
| | [Similar Code](https://pr-agent-docs.codium.ai/tools/similar_code/) 💎 | ✅ | | | |
|
||||||
| | | | | | |
|
| | | | | | |
|
||||||
| USAGE | CLI | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| USAGE | CLI | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | App / webhook | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | App / webhook | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | Tagging bot | :white_check_mark: | | | |
|
| | Tagging bot | ✅ | | | |
|
||||||
| | Actions | :white_check_mark: | | :white_check_mark: | |
|
| | Actions | ✅ | | ✅ | |
|
||||||
| | | | | | |
|
| | | | | | |
|
||||||
| CORE | PR compression | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| CORE | PR compression | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | Repo language prioritization | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | Repo language prioritization | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | Adaptive and token-aware file patch fitting | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | Adaptive and token-aware file patch fitting | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | Multiple models support | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | Multiple models support | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | [Static code analysis](https://pr-agent-docs.codium.ai/core-abilities/#static-code-analysis) 💎 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | [Static code analysis](https://pr-agent-docs.codium.ai/core-abilities/#static-code-analysis) 💎 | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | [Global and wiki configurations](https://pr-agent-docs.codium.ai/usage-guide/configuration_options/) 💎 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| | [Global and wiki configurations](https://pr-agent-docs.codium.ai/usage-guide/configuration_options/) 💎 | ✅ | ✅ | ✅ | ✅ |
|
||||||
| | [PR interactive actions](https://www.codium.ai/images/pr_agent/pr-actions.mp4) 💎 | :white_check_mark: | | | |
|
| | [PR interactive actions](https://www.codium.ai/images/pr_agent/pr-actions.mp4) 💎 | ✅ | | | |
|
||||||
- 💎 means this feature is available only in [PR-Agent Pro](https://www.codium.ai/pricing/)
|
- 💎 means this feature is available only in [PR-Agent Pro](https://www.codium.ai/pricing/)
|
||||||
|
|
||||||
[//]: # (- Support for additional git providers is described in [here](./docs/Full_environments.md))
|
[//]: # (- Support for additional git providers is described in [here](./docs/Full_environments.md))
|
||||||
@ -240,7 +244,8 @@ To use your own version of PR-Agent, you first need to acquire two tokens:
|
|||||||
There are several ways to use PR-Agent:
|
There are several ways to use PR-Agent:
|
||||||
|
|
||||||
**Locally**
|
**Locally**
|
||||||
- [Use Docker image (no installation required)](https://pr-agent-docs.codium.ai/installation/locally/#use-docker-image-no-installation-required)
|
- [Using pip package](https://pr-agent-docs.codium.ai/installation/locally/#using-pip-package)
|
||||||
|
- [Using Docker image](https://pr-agent-docs.codium.ai/installation/locally/#using-docker-image)
|
||||||
- [Run from source](https://pr-agent-docs.codium.ai/installation/locally/#run-from-source)
|
- [Run from source](https://pr-agent-docs.codium.ai/installation/locally/#run-from-source)
|
||||||
|
|
||||||
**GitHub specific methods**
|
**GitHub specific methods**
|
||||||
|
@ -1,4 +1,45 @@
|
|||||||
## Use Docker image (no installation required)
|
## Using pip package
|
||||||
|
|
||||||
|
Install the package:
|
||||||
|
|
||||||
|
```
|
||||||
|
pip install pr-agent
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run the relevant tool with the script below.
|
||||||
|
<br>
|
||||||
|
Make sure to fill in the required parameters (`user_token`, `openai_key`, `pr_url`, `command`):
|
||||||
|
|
||||||
|
```python
|
||||||
|
from pr_agent import cli
|
||||||
|
from pr_agent.config_loader import get_settings
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Fill in the following values
|
||||||
|
provider = "github" # GitHub provider
|
||||||
|
user_token = "..." # GitHub user token
|
||||||
|
openai_key = "..." # OpenAI key
|
||||||
|
pr_url = "..." # PR URL, for example 'https://github.com/Codium-ai/pr-agent/pull/809'
|
||||||
|
command = "/review" # Command to run (e.g. '/review', '/describe', '/ask="What is the purpose of this PR?"', ...)
|
||||||
|
|
||||||
|
# Setting the configurations
|
||||||
|
get_settings().set("CONFIG.git_provider", provider)
|
||||||
|
get_settings().set("openai.key", openai_key)
|
||||||
|
get_settings().set("github.user_token", user_token)
|
||||||
|
|
||||||
|
# Preparing the command
|
||||||
|
run_command = f"--pr_url={pr_url} {command.lstrip('/')}"
|
||||||
|
args = cli.set_parser().parse_args(run_command.split())
|
||||||
|
|
||||||
|
# Run the command. Feedback will appear in GitHub PR comments
|
||||||
|
cli.run(args=args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using Docker image
|
||||||
|
|
||||||
A list of the relevant tools can be found in the [tools guide](../tools/ask.md).
|
A list of the relevant tools can be found in the [tools guide](../tools/ask.md).
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
## Local repo (CLI)
|
## Local repo (CLI)
|
||||||
When running from your local repo (CLI), your local configuration file will be used.
|
When running from your locally cloned PR-Agent repo (CLI), your local configuration file will be used.
|
||||||
Examples of invoking the different tools via the CLI:
|
Examples of invoking the different tools via the CLI:
|
||||||
|
|
||||||
- **Review**: `python -m pr_agent.cli --pr_url=<pr_url> review`
|
- **Review**: `python -m pr_agent.cli --pr_url=<pr_url> review`
|
||||||
|
@ -9,48 +9,52 @@ from pr_agent.log import setup_logger
|
|||||||
log_level = os.environ.get("LOG_LEVEL", "INFO")
|
log_level = os.environ.get("LOG_LEVEL", "INFO")
|
||||||
setup_logger(log_level)
|
setup_logger(log_level)
|
||||||
|
|
||||||
|
def set_parser():
|
||||||
|
|
||||||
def run(inargs=None):
|
|
||||||
parser = argparse.ArgumentParser(description='AI based pull request analyzer', usage=
|
parser = argparse.ArgumentParser(description='AI based pull request analyzer', usage=
|
||||||
"""\
|
"""\
|
||||||
Usage: cli.py --pr-url=<URL on supported git hosting service> <command> [<args>].
|
Usage: cli.py --pr-url=<URL on supported git hosting service> <command> [<args>].
|
||||||
For example:
|
For example:
|
||||||
- cli.py --pr_url=... review
|
- cli.py --pr_url=... review
|
||||||
- cli.py --pr_url=... describe
|
- cli.py --pr_url=... describe
|
||||||
- cli.py --pr_url=... improve
|
- cli.py --pr_url=... improve
|
||||||
- cli.py --pr_url=... ask "write me a poem about this PR"
|
- cli.py --pr_url=... ask "write me a poem about this PR"
|
||||||
- cli.py --pr_url=... reflect
|
- cli.py --pr_url=... reflect
|
||||||
- cli.py --issue_url=... similar_issue
|
- cli.py --issue_url=... similar_issue
|
||||||
|
|
||||||
Supported commands:
|
Supported commands:
|
||||||
- review / review_pr - Add a review that includes a summary of the PR and specific suggestions for improvement.
|
- review / review_pr - Add a review that includes a summary of the PR and specific suggestions for improvement.
|
||||||
|
|
||||||
- ask / ask_question [question] - Ask a question about the PR.
|
- ask / ask_question [question] - Ask a question about the PR.
|
||||||
|
|
||||||
- describe / describe_pr - Modify the PR title and description based on the PR's contents.
|
- describe / describe_pr - Modify the PR title and description based on the PR's contents.
|
||||||
|
|
||||||
- improve / improve_code - Suggest improvements to the code in the PR as pull request comments ready to commit.
|
- improve / improve_code - Suggest improvements to the code in the PR as pull request comments ready to commit.
|
||||||
Extended mode ('improve --extended') employs several calls, and provides a more thorough feedback
|
Extended mode ('improve --extended') employs several calls, and provides a more thorough feedback
|
||||||
|
|
||||||
- reflect - Ask the PR author questions about the PR.
|
- reflect - Ask the PR author questions about the PR.
|
||||||
|
|
||||||
- update_changelog - Update the changelog based on the PR's contents.
|
- update_changelog - Update the changelog based on the PR's contents.
|
||||||
|
|
||||||
- add_docs
|
- add_docs
|
||||||
|
|
||||||
- generate_labels
|
- generate_labels
|
||||||
|
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
To edit any configuration parameter from 'configuration.toml', just add -config_path=<value>.
|
To edit any configuration parameter from 'configuration.toml', just add -config_path=<value>.
|
||||||
For example: 'python cli.py --pr_url=... review --pr_reviewer.extra_instructions="focus on the file: ..."'
|
For example: 'python cli.py --pr_url=... review --pr_reviewer.extra_instructions="focus on the file: ..."'
|
||||||
""")
|
""")
|
||||||
parser.add_argument('--pr_url', type=str, help='The URL of the PR to review', default=None)
|
parser.add_argument('--pr_url', type=str, help='The URL of the PR to review', default=None)
|
||||||
parser.add_argument('--issue_url', type=str, help='The URL of the Issue to review', default=None)
|
parser.add_argument('--issue_url', type=str, help='The URL of the Issue to review', default=None)
|
||||||
parser.add_argument('command', type=str, help='The', choices=commands, default='review')
|
parser.add_argument('command', type=str, help='The', choices=commands, default='review')
|
||||||
parser.add_argument('rest', nargs=argparse.REMAINDER, default=[])
|
parser.add_argument('rest', nargs=argparse.REMAINDER, default=[])
|
||||||
args = parser.parse_args(inargs)
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
def run(inargs=None, args=None):
|
||||||
|
parser = set_parser()
|
||||||
|
if not args:
|
||||||
|
args = parser.parse_args(inargs)
|
||||||
if not args.pr_url and not args.issue_url:
|
if not args.pr_url and not args.issue_url:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
return
|
return
|
||||||
|
30
pr_agent/cli_pip.py
Normal file
30
pr_agent/cli_pip.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
from pr_agent import cli
|
||||||
|
from pr_agent.config_loader import get_settings
|
||||||
|
from pr_agent.log import setup_logger
|
||||||
|
|
||||||
|
setup_logger()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Fill in the following values
|
||||||
|
provider = "github" # GitHub provider
|
||||||
|
user_token = "..." # GitHub user token
|
||||||
|
openai_key = "..." # OpenAI key
|
||||||
|
pr_url = "..." # PR URL, for example 'https://github.com/Codium-ai/pr-agent/pull/809'
|
||||||
|
command = "/review" # Command to run (e.g. '/review', '/describe', '/ask="What is the purpose of this PR?"')
|
||||||
|
|
||||||
|
# Setting the configurations
|
||||||
|
get_settings().set("CONFIG.git_provider", provider)
|
||||||
|
get_settings().set("openai.key", openai_key)
|
||||||
|
get_settings().set("github.user_token", user_token)
|
||||||
|
|
||||||
|
# Preparing the command
|
||||||
|
run_command = f"--pr_url={pr_url} {command.lstrip('/')}"
|
||||||
|
args = cli.set_parser().parse_args(run_command.split())
|
||||||
|
|
||||||
|
# Run the command. Feedback will appear in GitHub PR comments
|
||||||
|
cli.run(args=args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
0
pr_agent/servers/__init__.py
Normal file
0
pr_agent/servers/__init__.py
Normal file
@ -17,6 +17,7 @@ from pr_agent.servers.help import HelpMessage
|
|||||||
class PRQuestions:
|
class PRQuestions:
|
||||||
def __init__(self, pr_url: str, args=None, ai_handler: partial[BaseAiHandler,] = LiteLLMAIHandler):
|
def __init__(self, pr_url: str, args=None, ai_handler: partial[BaseAiHandler,] = LiteLLMAIHandler):
|
||||||
question_str = self.parse_args(args)
|
question_str = self.parse_args(args)
|
||||||
|
self.pr_url = pr_url
|
||||||
self.git_provider = get_git_provider()(pr_url)
|
self.git_provider = get_git_provider()(pr_url)
|
||||||
self.main_pr_language = get_main_pr_language(
|
self.main_pr_language = get_main_pr_language(
|
||||||
self.git_provider.get_languages(), self.git_provider.get_files()
|
self.git_provider.get_languages(), self.git_provider.get_files()
|
||||||
@ -49,7 +50,7 @@ class PRQuestions:
|
|||||||
return question_str
|
return question_str
|
||||||
|
|
||||||
async def run(self):
|
async def run(self):
|
||||||
get_logger().info('Answering a PR question...')
|
get_logger().info(f'Answering a PR question about the PR {self.pr_url} ')
|
||||||
relevant_configs = {'pr_questions': dict(get_settings().pr_questions),
|
relevant_configs = {'pr_questions': dict(get_settings().pr_questions),
|
||||||
'config': dict(get_settings().config)}
|
'config': dict(get_settings().config)}
|
||||||
get_logger().debug("Relevant configs", artifacts=relevant_configs)
|
get_logger().debug("Relevant configs", artifacts=relevant_configs)
|
||||||
|
@ -3,9 +3,6 @@ from enum import Enum
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import openai
|
import openai
|
||||||
import pandas as pd
|
|
||||||
import pinecone
|
|
||||||
from pinecone_datasets import Dataset, DatasetMetadata
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from pr_agent.algo import MAX_TOKENS
|
from pr_agent.algo import MAX_TOKENS
|
||||||
@ -36,6 +33,12 @@ class PRSimilarIssue:
|
|||||||
index_name = self.index_name = "codium-ai-pr-agent-issues"
|
index_name = self.index_name = "codium-ai-pr-agent-issues"
|
||||||
|
|
||||||
if get_settings().pr_similar_issue.vectordb == "pinecone":
|
if get_settings().pr_similar_issue.vectordb == "pinecone":
|
||||||
|
try:
|
||||||
|
import pinecone
|
||||||
|
from pinecone_datasets import Dataset, DatasetMetadata
|
||||||
|
import pandas as pd
|
||||||
|
except:
|
||||||
|
raise Exception("Please install 'pinecone' and 'pinecone_datasets' to use pinecone as vectordb")
|
||||||
# assuming pinecone api key and environment are set in secrets file
|
# assuming pinecone api key and environment are set in secrets file
|
||||||
try:
|
try:
|
||||||
api_key = get_settings().pinecone.api_key
|
api_key = get_settings().pinecone.api_key
|
||||||
@ -107,7 +110,10 @@ class PRSimilarIssue:
|
|||||||
get_logger().info('No new issues to update')
|
get_logger().info('No new issues to update')
|
||||||
|
|
||||||
elif get_settings().pr_similar_issue.vectordb == "lancedb":
|
elif get_settings().pr_similar_issue.vectordb == "lancedb":
|
||||||
import lancedb # import lancedb only if needed
|
try:
|
||||||
|
import lancedb # import lancedb only if needed
|
||||||
|
except:
|
||||||
|
raise Exception("Please install lancedb to use lancedb as vectordb")
|
||||||
self.db = lancedb.connect(get_settings().lancedb.uri)
|
self.db = lancedb.connect(get_settings().lancedb.uri)
|
||||||
self.table = None
|
self.table = None
|
||||||
|
|
||||||
|
@ -3,44 +3,44 @@ requires = ["setuptools>=61.0"]
|
|||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "pr_agent"
|
name = "pr-agent"
|
||||||
version = "0.0.1"
|
version = "0.2.0"
|
||||||
|
|
||||||
|
authors = [{name= "CodiumAI", email = "tal.r@codium.ai"}]
|
||||||
|
|
||||||
authors = [
|
|
||||||
{name = "Itamar Friedman", email = "itamar.f@codium.ai"},
|
|
||||||
]
|
|
||||||
maintainers = [
|
maintainers = [
|
||||||
{name = "Ori Kotek", email = "ori.k@codium.ai"},
|
|
||||||
{name = "Tal Ridnik", email = "tal.r@codium.ai"},
|
{name = "Tal Ridnik", email = "tal.r@codium.ai"},
|
||||||
|
{name = "Ori Kotek", email = "ori.k@codium.ai"},
|
||||||
{name = "Hussam Lawen", email = "hussam.l@codium.ai"},
|
{name = "Hussam Lawen", email = "hussam.l@codium.ai"},
|
||||||
{name = "Sagi Medina", email = "sagi.m@codium.ai"}
|
|
||||||
]
|
]
|
||||||
description = "CodiumAI PR-Agent is an open-source tool to automatically analyze a pull request and provide several types of feedback"
|
|
||||||
|
description = "CodiumAI PR-Agent aims to help efficiently review and handle pull requests, by providing AI feedbacks and suggestions."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
keywords = ["ai", "tool", "developer", "review", "agent"]
|
keywords = ["AI", "Agents", "Pull Request", "Automation", "Code Review"]
|
||||||
license = {file = "LICENSE", name = "Apache 2.0 License"}
|
license = {name = "Apache 2.0", file = "LICENSE"}
|
||||||
|
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 3 - Alpha",
|
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"Operating System :: Independent",
|
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
]
|
]
|
||||||
dynamic = ["dependencies"]
|
dynamic = ["dependencies"]
|
||||||
|
|
||||||
|
|
||||||
[tool.setuptools.dynamic]
|
[tool.setuptools.dynamic]
|
||||||
dependencies = {file = ["requirements.txt"]}
|
dependencies = {file = ["requirements.txt"]}
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
"Homepage" = "https://github.com/Codium-ai/pr-agent"
|
"Homepage" = "https://github.com/Codium-ai/pr-agent"
|
||||||
|
"Documentation" = "https://pr-agent-docs.codium.ai/"
|
||||||
|
|
||||||
[tool.setuptools]
|
[tool.setuptools]
|
||||||
include-package-data = false
|
include-package-data = true
|
||||||
license-files = ["LICENSE"]
|
license-files = ["LICENSE"]
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["."]
|
where = ["."]
|
||||||
include = ["pr_agent"]
|
include = ["pr_agent*"] # include pr_agent and any sub-packages it finds under it.
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
pr-agent = "pr_agent.cli:run"
|
pr-agent = "pr_agent.cli:run"
|
||||||
|
@ -1 +1,3 @@
|
|||||||
pytest==7.4.0
|
pytest==7.4.0
|
||||||
|
poetry
|
||||||
|
twine
|
@ -13,9 +13,6 @@ litellm==1.31.10
|
|||||||
loguru==0.7.2
|
loguru==0.7.2
|
||||||
msrest==0.7.1
|
msrest==0.7.1
|
||||||
openai==1.13.3
|
openai==1.13.3
|
||||||
pinecone-client
|
|
||||||
pinecone-datasets @ git+https://github.com/mrT23/pinecone-datasets.git@main
|
|
||||||
lancedb==0.5.1
|
|
||||||
pytest==7.4.0
|
pytest==7.4.0
|
||||||
PyGithub==1.59.*
|
PyGithub==1.59.*
|
||||||
PyYAML==6.0.1
|
PyYAML==6.0.1
|
||||||
@ -26,4 +23,9 @@ tiktoken==0.5.2
|
|||||||
ujson==5.8.0
|
ujson==5.8.0
|
||||||
uvicorn==0.22.0
|
uvicorn==0.22.0
|
||||||
tenacity==8.2.3
|
tenacity==8.2.3
|
||||||
# langchain==0.0.349 # uncomment this to support language LangChainOpenAIHandler
|
# Uncomment the following lines to enable the 'similar issue' tool
|
||||||
|
# pinecone-client
|
||||||
|
# pinecone-datasets @ git+https://github.com/mrT23/pinecone-datasets.git@main
|
||||||
|
# lancedb==0.5.1
|
||||||
|
# uncomment this to support language LangChainOpenAIHandler
|
||||||
|
# langchain==0.0.349
|
||||||
|
Reference in New Issue
Block a user