Skip to content

Commit 7779038

Browse files
authored
Merge pull request #912 from Codium-ai/tr/show_config
Tr/show config
2 parents 2369b8d + c3dca2e commit 7779038

File tree

7 files changed

+14
-10
lines changed

7 files changed

+14
-10
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ CodiumAI PR-Agent aims to help efficiently review and handle pull requests, by p
4141

4242
## News and Updates
4343

44+
### May 19, 2024
45+
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.
46+
4447
### May 12, 2024
4548
Inspired by [AlphaCodium](https://github.com/Codium-ai/AlphaCodium) flow engineering scheme, PR-Agent now performs **self-reflection** on the code suggestions it provides,
4649
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.

pr_agent/algo/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ def github_action_output(output_data: dict, key_name: str):
678678

679679
def show_relevant_configurations(relevant_section: str) -> str:
680680
forbidden_keys = ['ai_disclaimer', 'ai_disclaimer_title', 'ANALYTICS_FOLDER', 'secret_provider',
681-
'trial_prefix_message', 'no_eligible_message', 'identity_provider']
681+
'trial_prefix_message', 'no_eligible_message', 'identity_provider', 'ALLOWED_REPOS','APP_NAME']
682682

683683
markdown_text = ""
684684
markdown_text += "\n<hr>\n<details> <summary><strong>🛠️ Relevant configurations:</strong></summary> \n\n"

pr_agent/settings/configuration.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[config]
22
model="gpt-4-turbo-2024-04-09"
3-
model_turbo="gpt-4-turbo-2024-04-09"
3+
model_turbo="gpt-4o"
44
fallback_models=["gpt-4-0125-preview"]
55
git_provider="github"
66
publish_output=true

pr_agent/tools/pr_code_suggestions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ async def run(self):
8282
self.git_provider.publish_comment("Preparing suggestions...", is_temporary=True)
8383

8484
if not self.is_extended:
85-
data = await retry_with_fallback_models(self._prepare_prediction, ModelType.TURBO)
85+
data = await retry_with_fallback_models(self._prepare_prediction)
8686
else:
87-
data = await retry_with_fallback_models(self._prepare_prediction_extended, ModelType.TURBO)
87+
data = await retry_with_fallback_models(self._prepare_prediction_extended)
8888
if not data:
8989
data = {"code_suggestions": []}
9090

@@ -184,7 +184,8 @@ async def _get_prediction(self, model: str, patches_diff: str) -> dict:
184184

185185
# self-reflect on suggestions
186186
if get_settings().pr_code_suggestions.self_reflect_on_suggestions:
187-
response_reflect = await self.self_reflect_on_suggestions(data["code_suggestions"], patches_diff)
187+
model = get_settings().config.model_turbo # use turbo model for self-reflection, since it is an easier task
188+
response_reflect = await self.self_reflect_on_suggestions(data["code_suggestions"], patches_diff, model=model)
188189
if response_reflect:
189190
response_reflect_yaml = load_yaml(response_reflect)
190191
code_suggestions_feedback = response_reflect_yaml["code_suggestions"]
@@ -546,7 +547,7 @@ def generate_summarized_suggestions(self, data: Dict) -> str:
546547
get_logger().info(f"Failed to publish summarized code suggestions, error: {e}")
547548
return ""
548549

549-
async def self_reflect_on_suggestions(self, suggestion_list: List, patches_diff: str) -> str:
550+
async def self_reflect_on_suggestions(self, suggestion_list: List, patches_diff: str, model: str) -> str:
550551
if not suggestion_list:
551552
return ""
552553

@@ -559,7 +560,6 @@ async def self_reflect_on_suggestions(self, suggestion_list: List, patches_diff:
559560
'suggestion_str': suggestion_str,
560561
"diff": patches_diff,
561562
'num_code_suggestions': len(suggestion_list)}
562-
model = get_settings().config.model
563563
environment = Environment(undefined=StrictUndefined)
564564
system_prompt_reflect = environment.from_string(get_settings().pr_code_suggestions_reflect_prompt.system).render(
565565
variables)

pr_agent/tools/pr_description.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def run(self):
8282
if get_settings().config.publish_output:
8383
self.git_provider.publish_comment("Preparing PR description...", is_temporary=True)
8484

85-
await retry_with_fallback_models(self._prepare_prediction, ModelType.TURBO) # turbo model because larger context
85+
await retry_with_fallback_models(self._prepare_prediction, ModelType.TURBO)
8686

8787
if self.prediction:
8888
self._prepare_data()

pr_agent/tools/pr_questions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pr_agent.algo.ai_handlers.litellm_ai_handler import LiteLLMAIHandler
88
from pr_agent.algo.pr_processing import get_pr_diff, retry_with_fallback_models
99
from pr_agent.algo.token_handler import TokenHandler
10+
from pr_agent.algo.utils import ModelType
1011
from pr_agent.config_loader import get_settings
1112
from pr_agent.git_providers import get_git_provider
1213
from pr_agent.git_providers.git_provider import get_main_pr_language
@@ -62,7 +63,7 @@ async def run(self):
6263
if img_path:
6364
get_logger().debug(f"Image path identified", artifact=img_path)
6465

65-
await retry_with_fallback_models(self._prepare_prediction)
66+
await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.TURBO)
6667

6768
pr_comment = self._prepare_pr_answer()
6869
get_logger().debug(f"PR output", artifact=pr_comment)

pr_agent/tools/pr_reviewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async def run(self) -> None:
125125
if get_settings().config.publish_output:
126126
self.git_provider.publish_comment("Preparing review...", is_temporary=True)
127127

128-
await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.TURBO)
128+
await retry_with_fallback_models(self._prepare_prediction)
129129
if not self.prediction:
130130
self.git_provider.remove_initial_comment()
131131
return None

0 commit comments

Comments
 (0)