From 9b56c83c1de4bb28e18437423a0b83d92c9a66f2 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Sun, 19 May 2024 12:18:22 +0300 Subject: [PATCH 1/5] APP_NAME --- pr_agent/algo/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index f2ef00a5d..0888a15a8 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -678,7 +678,7 @@ def github_action_output(output_data: dict, key_name: str): def show_relevant_configurations(relevant_section: str) -> str: forbidden_keys = ['ai_disclaimer', 'ai_disclaimer_title', 'ANALYTICS_FOLDER', 'secret_provider', - 'trial_prefix_message', 'no_eligible_message', 'identity_provider'] + 'trial_prefix_message', 'no_eligible_message', 'identity_provider', 'ALLOWED_REPOS','APP_NAME'] markdown_text = "" markdown_text += "\n
\n
🛠️ Relevant configurations: \n\n" From 2880e4886090c6d42428cd33efa108cf3247de3a Mon Sep 17 00:00:00 2001 From: mrT23 Date: Sun, 19 May 2024 12:29:06 +0300 Subject: [PATCH 2/5] Refactor model selection logic for PR tools and update turbo model to gpt-4o --- pr_agent/settings/configuration.toml | 2 +- pr_agent/tools/pr_code_suggestions.py | 10 +++++----- pr_agent/tools/pr_description.py | 2 +- pr_agent/tools/pr_questions.py | 3 ++- pr_agent/tools/pr_reviewer.py | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index fa9b1afd1..448dfb57f 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -1,6 +1,6 @@ [config] model="gpt-4-turbo-2024-04-09" -model_turbo="gpt-4-turbo-2024-04-09" +model_turbo="gpt-4o" fallback_models=["gpt-4-0125-preview"] git_provider="github" publish_output=true diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index 6dead2be2..358f2992b 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -82,9 +82,9 @@ async def run(self): self.git_provider.publish_comment("Preparing suggestions...", is_temporary=True) if not self.is_extended: - data = await retry_with_fallback_models(self._prepare_prediction, ModelType.TURBO) + data = await retry_with_fallback_models(self._prepare_prediction) else: - data = await retry_with_fallback_models(self._prepare_prediction_extended, ModelType.TURBO) + data = await retry_with_fallback_models(self._prepare_prediction_extended) if not data: data = {"code_suggestions": []} @@ -184,7 +184,8 @@ async def _get_prediction(self, model: str, patches_diff: str) -> dict: # self-reflect on suggestions if get_settings().pr_code_suggestions.self_reflect_on_suggestions: - response_reflect = await self.self_reflect_on_suggestions(data["code_suggestions"], patches_diff) + model = get_settings().config.model_turbo # use turbo model for self-reflection, since it is an easier task + response_reflect = await self.self_reflect_on_suggestions(data["code_suggestions"], patches_diff, model=model) if response_reflect: response_reflect_yaml = load_yaml(response_reflect) code_suggestions_feedback = response_reflect_yaml["code_suggestions"] @@ -546,7 +547,7 @@ def generate_summarized_suggestions(self, data: Dict) -> str: get_logger().info(f"Failed to publish summarized code suggestions, error: {e}") return "" - async def self_reflect_on_suggestions(self, suggestion_list: List, patches_diff: str) -> str: + async def self_reflect_on_suggestions(self, suggestion_list: List, patches_diff: str, model: str) -> str: if not suggestion_list: return "" @@ -559,7 +560,6 @@ async def self_reflect_on_suggestions(self, suggestion_list: List, patches_diff: 'suggestion_str': suggestion_str, "diff": patches_diff, 'num_code_suggestions': len(suggestion_list)} - model = get_settings().config.model environment = Environment(undefined=StrictUndefined) system_prompt_reflect = environment.from_string(get_settings().pr_code_suggestions_reflect_prompt.system).render( variables) diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 0de93c9c9..96f6512d9 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -82,7 +82,7 @@ async def run(self): if get_settings().config.publish_output: self.git_provider.publish_comment("Preparing PR description...", is_temporary=True) - await retry_with_fallback_models(self._prepare_prediction, ModelType.TURBO) # turbo model because larger context + await retry_with_fallback_models(self._prepare_prediction, ModelType.TURBO) if self.prediction: self._prepare_data() diff --git a/pr_agent/tools/pr_questions.py b/pr_agent/tools/pr_questions.py index 78db1452b..3e6355f51 100644 --- a/pr_agent/tools/pr_questions.py +++ b/pr_agent/tools/pr_questions.py @@ -7,6 +7,7 @@ from pr_agent.algo.ai_handlers.litellm_ai_handler import LiteLLMAIHandler from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models from pr_agent.algo.token_handler import TokenHandler +from pr_agent.algo.utils import ModelType from pr_agent.config_loader import get_settings from pr_agent.git_providers import get_git_provider from pr_agent.git_providers.git_provider import get_main_pr_language @@ -62,7 +63,7 @@ async def run(self): if img_path: get_logger().debug(f"Image path identified", artifact=img_path) - await retry_with_fallback_models(self._prepare_prediction) + await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.TURBO) pr_comment = self._prepare_pr_answer() get_logger().debug(f"PR output", artifact=pr_comment) diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index 33adab39c..3a127f4ca 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -125,7 +125,7 @@ async def run(self) -> None: if get_settings().config.publish_output: self.git_provider.publish_comment("Preparing review...", is_temporary=True) - await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.TURBO) + await retry_with_fallback_models(self._prepare_prediction) if not self.prediction: self.git_provider.remove_initial_comment() return None From 8921d9eb0ebe1a2ab966d0522b126945494590ee Mon Sep 17 00:00:00 2001 From: mrT23 Date: Sun, 19 May 2024 12:35:19 +0300 Subject: [PATCH 3/5] Refactor model selection logic for PR tools and update turbo model to gpt-4o --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index bdac3fc08..401b87af6 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,9 @@ CodiumAI PR-Agent aims to help efficiently review and handle pull requests, by p ## News and Updates +### May 19, 2024 +GPT-4o is now the default fast model ("Turbo"). This model will be used for all command except `review` and `improve`, which will still use "GPT-4-turbo-2024-04-09", since they are harder and would still benefit from the larger model. + ### May 12, 2024 Inspired by [AlphaCodium](https://github.com/Codium-ai/AlphaCodium) flow engineering scheme, PR-Agent now performs **self-reflection** on the code suggestions it provides, enabling to remove invalid suggestions, and score the valid ones. The suggestions will be presented sorted by their score, enabling to focus on the most important ones first. From 985b4f05cf90556babebc7b06d3427e45ea2e50b Mon Sep 17 00:00:00 2001 From: mrT23 Date: Sun, 19 May 2024 12:37:06 +0300 Subject: [PATCH 4/5] Refactor model selection logic for PR tools and update turbo model to gpt-4o --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 401b87af6..85d0c8fc9 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ CodiumAI PR-Agent aims to help efficiently review and handle pull requests, by p ## News and Updates ### May 19, 2024 -GPT-4o is now the default fast model ("Turbo"). This model will be used for all command except `review` and `improve`, which will still use "GPT-4-turbo-2024-04-09", since they are harder and would still benefit from the larger model. +GPT-4o is now the default fast model ("Turbo"). This model will be used for all command except `review` and `improve`, which will still use "GPT-4-2024-04-09", since they are harder and would still benefit from the larger model. ### May 12, 2024 Inspired by [AlphaCodium](https://github.com/Codium-ai/AlphaCodium) flow engineering scheme, PR-Agent now performs **self-reflection** on the code suggestions it provides, From c3dca2ef5ae4027502eeb77eb9911cbf767aab9b Mon Sep 17 00:00:00 2001 From: mrT23 Date: Sun, 19 May 2024 12:37:31 +0300 Subject: [PATCH 5/5] Refactor model selection logic for PR tools and update turbo model to gpt-4o --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85d0c8fc9..3845ab562 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ CodiumAI PR-Agent aims to help efficiently review and handle pull requests, by p ## News and Updates ### May 19, 2024 -GPT-4o is now the default fast model ("Turbo"). This model will be used for all command except `review` and `improve`, which will still use "GPT-4-2024-04-09", since they are harder and would still benefit from the larger model. +GPT-4o is now the default fast model ("Turbo"). This model will be used for all commands except `review` and `improve`, which will still use "GPT-4-2024-04-09", since they are harder and would still benefit from the larger model. ### May 12, 2024 Inspired by [AlphaCodium](https://github.com/Codium-ai/AlphaCodium) flow engineering scheme, PR-Agent now performs **self-reflection** on the code suggestions it provides,