diff --git a/README.md b/README.md index da5159c4..ad3c0407 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,12 @@ Making pull requests less painful with an AI agent ## News and Updates +### Jan 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). +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. + + + ### Jan 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. diff --git a/docs/docs/assets/logo.svg b/docs/docs/assets/logo.svg new file mode 100644 index 00000000..5de22677 --- /dev/null +++ b/docs/docs/assets/logo.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/docs/css/custom.css b/docs/docs/css/custom.css index 0e9b26fe..2f963ccd 100644 --- a/docs/docs/css/custom.css +++ b/docs/docs/css/custom.css @@ -5,94 +5,14 @@ --md-accent-fg-color: #AEA1F1; } .md-nav__title, .md-nav__link { - font-size: 16px; /* Adjust the font size as needed */ + font-size: 16px; } .md-tabs__link { - font-size: 16px; /* Adjust the font size as needed */ + font-size: 16px; } .md-header__title { - font-size: 20px; /* Adjust the font size as needed */ + font-size: 20px; + margin-left: 0px !important; } - -/* -@media (prefers-color-scheme: light) { - body { - --md-primary-fg-color: #00ffee !important; - --md-primary-bg-color: #ff0000 !important; - } - - body, .md-main, .md-content { - background-color: #4312f5 !important; - } -} - -@media (prefers-color-scheme: dark) { - body { - --md-primary-fg-color: #171518 !important; - --md-primary-bg-color: #171518 !important; - } - - body, .md-main, .md-content { - background-color: #171518 !important; - } - - .md-header__title { - color: #ffffff !important; - } - - .md-tabs .md-tabs__link { - color: #ffffff !important; - } - - .md-tabs .md-tabs__link:hover, - .md-tabs .md-tabs__link:focus { - color: #ffffff !important; - } - - .md-header__button { - color: #ffffff !important; - } - - .md-header__button svg { - fill: currentColor !important; - } - - .md-header__button:hover, - .md-header__button:focus { - color: #ffffff !important; - } - - .md-header__button:hover svg, - .md-header__button:focus svg { - fill: currentColor !important; - } - - .md-search__icon svg { - fill: #ffffff !important; - } - - .md-search__input { - color: #ffffff !important; - } - - .md-nav__item--active > .md-nav__link--active, - .md-nav__link--active { - color: #AEA1F1 !important; - } - - .md-nav--secondary .md-nav__title { - background: #171518; - box-shadow: 0 0 0.4rem 0.4rem #171518; - } - - .md-nav--lifted>.md-nav__list>.md-nav__item--active>.md-nav__link { - background: #171518; - box-shadow: 0 0 0.4rem 0.4rem #171518; - } - - .md-content a { - color: #AEA1F1 !important; - } -} */ \ No newline at end of file diff --git a/docs/docs/index.md b/docs/docs/index.md index caa52ded..ed02e502 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -14,34 +14,34 @@ PR-Agent offers extensive pull request functionalities across various git provid | | | GitHub | Gitlab | Bitbucket | Azure DevOps | |-------|---------------------------------------------------------------------------------------------------------------------|:------:|:------:|:---------:|:------------:| -| TOOLS | Review | ✔️ | ✔️ | ✔️ | ✔️ | -| | ⮑ Incremental | ✔️ | | | | -| | ⮑ [SOC2 Compliance](https://pr-agent-docs.codium.ai/tools/review/#soc2-ticket-compliance){:target="_blank"} 💎 | ✔️ | ✔️ | ✔️ | ✔️ | -| | Ask | ✔️ | ✔️ | ✔️ | ✔️ | -| | Describe | ✔️ | ✔️ | ✔️ | ✔️ | -| | ⮑ [Inline file summary](https://pr-agent-docs.codium.ai/tools/describe/#inline-file-summary){:target="_blank"} 💎 | ✔️ | ✔️ | ✔️ | ✔️ | -| | Improve | ✔️ | ✔️ | ✔️ | ✔️ | -| | ⮑ Extended | ✔️ | ✔️ | ✔️ | ✔️ | -| | [Custom Suggestions](./tools/custom_suggestions.md){:target="_blank"} 💎 | ✔️ | ✔️ | ✔️ | ✔️ | -| | Reflect and Review | ✔️ | ✔️ | ✔️ | ✔️ | -| | Update CHANGELOG.md | ✔️ | ✔️ | ✔️ | ️ | -| | Find Similar Issue | ✔️ | | | ️ | -| | [Add PR Documentation](./tools/documentation.md){:target="_blank"} 💎 | ✔️ | ✔️ | ✔️ | ✔️ | -| | [Generate Custom Labels](./tools/describe.md#handle-custom-labels-from-the-repos-labels-page-💎){:target="_blank"} 💎 | ✔️ | ✔️ | | ✔️ | -| | [Analyze PR Components](./tools/analyze.md){:target="_blank"} 💎 | ✔️ | ✔️ | ✔️ | ✔️ | +| TOOLS | Review | ✅ | ✅ | ✅ | ✅ | +| | ⮑ Incremental | ✅ | | | | +| | ⮑ [SOC2 Compliance](https://pr-agent-docs.codium.ai/tools/review/#soc2-ticket-compliance){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | +| | Ask | ✅ | ✅ | ✅ | ✅ | +| | Describe | ✅ | ✅ | ✅ | ✅ | +| | ⮑ [Inline file summary](https://pr-agent-docs.codium.ai/tools/describe/#inline-file-summary){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | +| | Improve | ✅ | ✅ | ✅ | ✅ | +| | ⮑ Extended | ✅ | ✅ | ✅ | ✅ | +| | [Custom Suggestions](./tools/custom_suggestions.md){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | +| | Reflect and Review | ✅ | ✅ | ✅ | ✅ | +| | Update CHANGELOG.md | ✅ | ✅ | ✅ | ️ | +| | Find Similar Issue | ✅ | | | ️ | +| | [Add PR Documentation](./tools/documentation.md){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | +| | [Generate Custom Labels](./tools/describe.md#handle-custom-labels-from-the-repos-labels-page-💎){:target="_blank"} 💎 | ✅ | ✅ | | ✅ | +| | [Analyze PR Components](./tools/analyze.md){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | | | | | | | ️ | -| USAGE | CLI | ✔️ | ✔️ | ✔️ | ✔️ | -| | App / webhook | ✔️ | ✔️ | | ✔️ | -| | Tagging bot | ✔️ | | | ✔️ | -| | Actions | ✔️ | | | ️ | +| USAGE | CLI | ✅ | ✅ | ✅ | ✅ | +| | App / webhook | ✅ | ✅ | | ✅ | +| | Tagging bot | ✅ | | | ✅ | +| | Actions | ✅ | | | ️ | | | | | | | -| CORE | PR compression | ✔️ | ✔️ | ✔️ | ✔️ | -| | Repo language prioritization | ✔️ | ✔️ | ✔️ | ✔️ | -| | Adaptive and token-aware file patch fitting | ✔️ | ✔️ | ✔️ | ✔️ | -| | Multiple models support | ✔️ | ✔️ | ✔️ | ✔️ | -| | Incremental PR review | ✔️ | | | | -| | [Static code analysis](./tools/analyze.md/){:target="_blank"} 💎 | ✔️ | ✔️ | ✔️ | ✔️ | -| | [Multiple configuration options](./usage-guide/configuration_options.md){:target="_blank"} 💎 | ✔️ | ✔️ | ✔️ | ✔️ | +| CORE | PR compression | ✅ | ✅ | ✅ | ✅ | +| | Repo language prioritization | ✅ | ✅ | ✅ | ✅ | +| | Adaptive and token-aware file patch fitting | ✅ | ✅ | ✅ | ✅ | +| | Multiple models support | ✅ | ✅ | ✅ | ✅ | +| | Incremental PR review | ✅ | | | | +| | [Static code analysis](./tools/analyze.md/){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | +| | [Multiple configuration options](./usage-guide/configuration_options.md){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | 💎 marks a feature available only in [PR-Agent Pro](https://www.codium.ai/pricing/){:target="_blank"} diff --git a/docs/docs/installation/index.md b/docs/docs/installation/index.md index 18b7b056..fc71ecbb 100644 --- a/docs/docs/installation/index.md +++ b/docs/docs/installation/index.md @@ -1,5 +1,6 @@ # Installation +## self-hosted PR-Agent If you choose to host you own PR-Agent, you first need to acquire two tokens: 1. An OpenAI key from [here](https://platform.openai.com/api-keys), with access to GPT-4 (or a key for [other models](../usage-guide/additional_configurations.md/#changing-a-model), if you prefer). @@ -13,7 +14,9 @@ There are several ways to use self-hosted PR-Agent: - [BitBucket](./bitbucket.md) - [Azure DevOps](./azure.md) -___ -Note that [PR-Agent Pro 💎](https://app.codium.ai/), an app for GitHub\GitLab\BitBucket hosted by CodiumAI, is also available. +## PR-Agent Pro 💎 +PR-Agent Pro, an app for GitHub\GitLab\BitBucket hosted by CodiumAI, is also available.
-With PR-Agent Pro Installation is as simple as signing up and adding the PR-Agent app to your relevant repo. \ No newline at end of file +With PR-Agent Pro Installation is as simple as signing up and adding the PR-Agent app to your relevant repo. +
+See [here](./pr_agent_pro.md) for more details. \ No newline at end of file diff --git a/docs/docs/installation/gitlab_pro.md b/docs/docs/installation/pr_agent_pro.md similarity index 50% rename from docs/docs/installation/gitlab_pro.md rename to docs/docs/installation/pr_agent_pro.md index 20902b74..cb371df7 100644 --- a/docs/docs/installation/gitlab_pro.md +++ b/docs/docs/installation/pr_agent_pro.md @@ -1,4 +1,27 @@ -## Install Hosted PR-Agent Pro for GitLab (Teams & Enterprise) + +## Getting Started with PR-Agent Pro + +PR-Agent Pro is a versatile application compatible with GitHub, GitLab, and BitBucket, hosted by CodiumAI. +See [here](https://pr-agent-docs.codium.ai/#pr-agent-pro) for more details about the benefits of using PR-Agent Pro. + +Interested parties can subscribe to PR-Agent Pro through the following [link](https://www.codium.ai/pricing/). +After subscribing, you are granted the ability to easily install the application across any of your repositories. + + + + + +Each user who wants to use PR-Agent pro needs to buy a seat. +Initially, CodiumAI offers a two-week trial period at no cost, after which continued access requires each user to secure a personal seat. +Once a user acquires a seat, they gain the flexibility to use PR-Agent Pro across any repository where it was enabled. + +Users without a purchased seat who interact with a repository featuring PR-Agent Pro are entitled to receive up to five complimentary feedbacks. +Beyond this limit, PR-Agent Pro will cease to respond to their inquiries unless a seat is purchased. + + +## Install PR-Agent Pro for GitLab (Teams & Enterprise) + +Since GitLab platform does not support apps, installing PR-Agent Pro for GitLab is a bit more involved, and requires the following steps: ### Step 1 diff --git a/docs/docs/usage-guide/additional_configurations.md b/docs/docs/usage-guide/additional_configurations.md index 4a6224bd..1a756252 100644 --- a/docs/docs/usage-guide/additional_configurations.md +++ b/docs/docs/usage-guide/additional_configurations.md @@ -162,8 +162,9 @@ To use Amazon Bedrock and its foundational models, add the below configuration: ``` [config] # in configuration.toml -model = "anthropic.claude-v2" -fallback_models="anthropic.claude-instant-v1" +model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" +model_turbo="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" +fallback_models=["bedrock/anthropic.claude-v2:1"] [aws] # in .secrets.toml bedrock_region = "us-east-1" @@ -171,6 +172,12 @@ bedrock_region = "us-east-1" Note that you have to add access to foundational models before using them. Please refer to [this document](https://docs.aws.amazon.com/bedrock/latest/userguide/setting-up.html) for more details. +If you are using the claude-3 model, please configure the following settings as there are parameters incompatible with claude-3. +``` +[litellm] +drop_params = true +``` + AWS session is automatically authenticated from your environment, but you can also explicitly set `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables. diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 0a76acf1..c3e10abd 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -7,9 +7,9 @@ nav: - Locally: 'installation/locally.md' - GitHub: 'installation/github.md' - GitLab: 'installation/gitlab.md' - - 💎 GitLab Pro: 'installation/gitlab_pro.md' - BitBucket: 'installation/bitbucket.md' - Azure DevOps: 'installation/azure.md' + - 💎 PR-Agent Pro: 'installation/pr_agent_pro.md' - Usage Guide: - 'usage-guide/index.md' - Introduction: 'usage-guide/introduction.md' @@ -35,7 +35,7 @@ nav: - Core Abilities: 'core-abilities/index.md' theme: - logo: assets/logo.png + logo: assets/logo.svg favicon: assets/favicon.ico name: material features: diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py index 7c537e3a..9e05ed9f 100644 --- a/pr_agent/algo/__init__.py +++ b/pr_agent/algo/__init__.py @@ -23,4 +23,9 @@ MAX_TOKENS = { 'anthropic.claude-v1': 100000, 'anthropic.claude-v2': 100000, 'anthropic/claude-3-opus-20240229': 100000, + 'bedrock/anthropic.claude-instant-v1': 100000, + 'bedrock/anthropic.claude-v2': 100000, + 'bedrock/anthropic.claude-v2:1': 100000, + 'bedrock/anthropic.claude-3-sonnet-20240229-v1:0': 100000, + 'bedrock/anthropic.claude-3-haiku-20240307-v1:0': 100000, } diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py index 527a20a8..ce4d1db0 100644 --- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -36,6 +36,8 @@ class LiteLLMAIHandler(BaseAiHandler): assert litellm_token, "LITELLM_TOKEN is required" os.environ["LITELLM_TOKEN"] = litellm_token litellm.use_client = True + if get_settings().get("LITELLM.DROP_PARAMS", None): + litellm.drop_params = get_settings().litellm.drop_params if get_settings().get("OPENAI.ORG", None): litellm.organization = get_settings().openai.org if get_settings().get("OPENAI.API_TYPE", None): @@ -68,6 +70,7 @@ class LiteLLMAIHandler(BaseAiHandler): ) if get_settings().get("AWS.BEDROCK_REGION", None): litellm.AmazonAnthropicConfig.max_tokens_to_sample = 2000 + litellm.AmazonAnthropicClaude3Config.max_tokens = 2000 self.aws_bedrock_client = boto3.client( service_name="bedrock-runtime", region_name=get_settings().aws.bedrock_region, diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index dede9850..c2b6323c 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -70,6 +70,7 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool = True, increment """ emojis = { + "Can be split": "🔀", "Possible issues": "🔍", "Score": "🏅", "Relevant tests": "🧪", @@ -94,7 +95,8 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool = True, increment for key, value in output_data['review'].items(): if value is None or value == '' or value == {} or value == []: - continue + if key.lower() != 'can_be_split': + continue key_nice = key.replace('_', ' ').capitalize() emoji = emojis.get(key_nice, "") if gfm_supported: @@ -103,6 +105,8 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool = True, increment if 'security concerns' in key_nice.lower(): value = emphasize_header(value.strip()) markdown_text += f" {emoji} {key_nice}\n\n{value}\n\n\n" + elif 'can be split' in key_nice.lower(): + markdown_text += process_can_be_split(emoji, value) elif 'possible issues' in key_nice.lower(): value = value.strip() issues = value.split('\n- ') @@ -154,6 +158,38 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool = True, increment return markdown_text +def process_can_be_split(emoji, value): + # key_nice = "Can this PR be split?" + key_nice = "Multiple PR themes" + markdown_text = "" + if not value or isinstance(value, list) and len(value) == 1: + value = "No" + markdown_text += f" {emoji} {key_nice}\n\n{value}\n\n\n" + else: + number_of_splits = len(value) + markdown_text += f" {emoji} {key_nice}\n" + for i, split in enumerate(value): + title = split.get('title', '') + relevant_files = split.get('relevant_files', []) + if i == 0: + markdown_text += f"
\nSub-PR theme: {title}\n\n" + markdown_text += f"
\n" + markdown_text += f"Relevant files:\n" + markdown_text += f"\n\n
\n" + else: + markdown_text += f"\n
\nSub-PR theme: {title}\n\n" + markdown_text += f"
\n" + markdown_text += f"Relevant files:\n" + markdown_text += f"\n\n
\n" + return markdown_text + + def parse_code_suggestion(code_suggestion: dict, i: int = 0, gfm_supported: bool = True) -> str: """ Convert a dictionary of data into markdown format. diff --git a/pr_agent/git_providers/git_provider.py b/pr_agent/git_providers/git_provider.py index 9eb09a1a..a7d772b7 100644 --- a/pr_agent/git_providers/git_provider.py +++ b/pr_agent/git_providers/git_provider.py @@ -197,6 +197,12 @@ class GitProvider(ABC): def calc_pr_statistics(self, pull_request_data: dict): return {} + def get_num_of_files(self): + try: + return len(self.get_diff_files()) + except Exception as e: + return -1 + def get_main_pr_language(languages, files) -> str: """ @@ -266,6 +272,7 @@ def get_main_pr_language(languages, files) -> str: return main_language_str + class IncrementalPR: def __init__(self, is_incremental: bool = False): self.is_incremental = is_incremental diff --git a/pr_agent/git_providers/github_provider.py b/pr_agent/git_providers/github_provider.py index b6d04bc0..de54ec3f 100644 --- a/pr_agent/git_providers/github_provider.py +++ b/pr_agent/git_providers/github_provider.py @@ -114,6 +114,11 @@ class GithubProvider(GitProvider): self.git_files = self.pr.get_files() return self.git_files + def get_num_of_files(self): + if self.git_files: + return self.git_files.totalCount + else: + return -1 @retry(exceptions=RateLimitExceeded, tries=get_settings().github.ratelimit_retries, delay=2, backoff=2, jitter=(1, 3)) diff --git a/pr_agent/servers/help.py b/pr_agent/servers/help.py index 1168c743..835ad8b9 100644 --- a/pr_agent/servers/help.py +++ b/pr_agent/servers/help.py @@ -95,7 +95,7 @@ The `review` tool can auto-generate two specific types of labels for a PR: The `review` tool provides a collection of possible feedbacks about a PR. It is recommended to review the [possible options](https://pr-agent-docs.codium.ai/tools/review/#enabledisable-features), and choose the ones relevant for your use case. Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example: -`require_score_review`, `require_soc2_ticket`, and more. +`require_score_review`, `require_soc2_ticket`, `require_can_be_split_review`, and more. """ output += "\n\n\n\n" diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index b5a0dab1..21ad264b 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -22,10 +22,10 @@ ai_disclaimer="" # Pro feature, full text for the AI disclaimer [pr_reviewer] # /review # # enable/disable features -require_focused_review=false require_score_review=false require_tests_review=true require_estimate_effort_to_review=true +require_can_be_split_review=false # soc2 require_soc2_ticket=false soc2_ticket_prompt="Does the PR description include a link to ticket in a project management system (e.g., Jira, Asana, Trello, etc.) ?" @@ -192,7 +192,8 @@ pr_commands = [ url = "" [litellm] -#use_client = false +# use_client = false +# drop_params = false [pr_similar_issue] skip_comments = false diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml index 16897292..aeeef5f8 100644 --- a/pr_agent/settings/pr_reviewer_prompts.toml +++ b/pr_agent/settings/pr_reviewer_prompts.toml @@ -49,6 +49,12 @@ Extra instructions from the user: The output must be a YAML object equivalent to type $PRReview, according to the following Pydantic definitions: ===== +{%- if require_can_be_split_review %} +class SubPR(BaseModel): + relevant_files: List[str] = Field(description="The relevant files of the sub-PR") + title: str = Field(description="Short and concise title for an independent and meaningful sub-PR, composed only from the relevant files") +{%- endif %} + class Review(BaseModel): {%- if require_estimate_effort_to_review %} estimated_effort_to_review_[1-5]: str = Field(description="Estimate, on a scale of 1-5 (inclusive), the time and effort required to review this PR by an experienced and knowledgeable developer. 1 means short and easy review , 5 means long and hard review. Take into account the size, complexity, quality, and the needed changes of the PR code diff. Explain your answer in a short and concise manner.") @@ -61,12 +67,12 @@ class Review(BaseModel): {%- endif %} {%- if question_str %} insights_from_user_answers: str = Field(description="shortly summarize the insights you gained from the user's answers to the questions") -{%- endif %} -{%- if require_focused %} - focused_pr: str = Field(description="Is this a focused PR, in the sense that all the PR code diff changes are united under a single focused theme ? If the theme is too broad, or the PR code diff changes are too scattered, then the PR is not focused. Explain your answer shortly.") {%- endif %} possible_issues: str = Field(description="Does this PR code introduce clear issues, bugs, or major performance concerns? If there are no apparent issues, respond with 'No'. If there are any issues, describe them briefly. Use bullet points if more than one issue. Be specific, and provide examples if possible. Start each bullet point with a short specific header, such as: "- Possible Bug: ...", etc.") security_concerns: str = Field(description="does this PR code introduce possible vulnerabilities such as exposure of sensitive information (e.g., API keys, secrets, passwords), or security concerns like SQL injection, XSS, CSRF, and others ? Answer 'No' if there are no possible issues. If there are security concerns or issues, start your answer with a short header, such as: 'Sensitive information exposure: ...', 'SQL injection: ...' etc. Explain your answer. Be specific and give examples if possible") +{%- if require_can_be_split_review %} + can_be_split: List[SubPR] = Field(min_items=0, max_items=3, description="Can this PR, which contains {{ num_pr_files }} changed files in total, be divided into smaller sub-PRs with distinct tasks that can be reviewed and merged independently, regardless of the order ? Make sure that the sub-PRs are indeed independent, with no code dependencies between them, and that each sub-PR represent a meaningfull independent task. Output an empty list if the PR code does not needd to be split.") +{%- endif %} {%- if num_code_suggestions > 0 %} class CodeSuggestion(BaseModel): @@ -100,14 +106,18 @@ review: {%- endif %} relevant_tests: | No -{%- if require_focused %} - focused_pr: | - no, because ... -{%- endif %} possible_issues: | No security_concerns: | No +{%- if require_can_be_split_review %} + can_be_split: | + - relevant_files: + - ... + - ... + title: ... + - ... +{%- endif %} {%- if num_code_suggestions > 0 %} code_feedback - relevant_file: | diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index f0475b82..4d1739a5 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -58,10 +58,11 @@ class PRReviewer: "description": self.git_provider.get_pr_description(), "language": self.main_language, "diff": "", # empty diff for initial calculation + "num_pr_files": self.git_provider.get_num_of_files(), "require_score": get_settings().pr_reviewer.require_score_review, "require_tests": get_settings().pr_reviewer.require_tests_review, - "require_focused": get_settings().pr_reviewer.require_focused_review, "require_estimate_effort_to_review": get_settings().pr_reviewer.require_estimate_effort_to_review, + 'require_can_be_split_review': get_settings().pr_reviewer.require_can_be_split_review, 'num_code_suggestions': get_settings().pr_reviewer.num_code_suggestions, 'question_str': question_str, 'answer_str': answer_str, @@ -372,6 +373,8 @@ class PRReviewer: review_labels.append('Possible security concern') current_labels = self.git_provider.get_pr_labels(update=True) + if not current_labels: + current_labels = [] get_logger().debug(f"Current labels:\n{current_labels}") if current_labels: current_labels_filtered = [label for label in current_labels if diff --git a/requirements.txt b/requirements.txt index 4d6daa93..97df2f93 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ GitPython==3.1.32 google-cloud-aiplatform==1.35.0 google-cloud-storage==2.10.0 Jinja2==3.1.2 -litellm==1.29.1 +litellm==1.31.10 loguru==0.7.2 msrest==0.7.1 openai==1.13.3