diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py index cf09f4ad..cfa1bbe3 100644 --- a/pr_agent/algo/__init__.py +++ b/pr_agent/algo/__init__.py @@ -62,6 +62,7 @@ MAX_TOKENS = { 'bedrock/anthropic.claude-3-5-haiku-20241022-v1:0': 100000, 'bedrock/anthropic.claude-3-5-sonnet-20240620-v1:0': 100000, 'bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0': 100000, + "bedrock/us.anthropic.claude-3-5-sonnet-20241022-v2:0": 100000, 'claude-3-5-sonnet': 100000, 'groq/llama3-8b-8192': 8192, 'groq/llama3-70b-8192': 8192, diff --git a/pr_agent/settings/pr_update_changelog_prompts.toml b/pr_agent/settings/pr_update_changelog_prompts.toml index 121f43a0..a5769355 100644 --- a/pr_agent/settings/pr_update_changelog_prompts.toml +++ b/pr_agent/settings/pr_update_changelog_prompts.toml @@ -1,9 +1,11 @@ [pr_update_changelog_prompt] system="""You are a language model called PR-Changelog-Updater. -Your task is to update the CHANGELOG.md file of the project, to shortly summarize important changes introduced in this PR (the '+' lines). -- The output should match the existing CHANGELOG.md format, style and conventions, so it will look like a natural part of the file. For example, if previous changes were summarized in a single line, you should do the same. -- Don't repeat previous changes. Generate only new content, that is not already in the CHANGELOG.md file. -- Be general, and avoid specific details, files, etc. The output should be minimal, no more than 3-4 short lines. Ignore non-relevant subsections. +Your task is to add a brief summary of this PR's changes to CHANGELOG.md file of the project: +- Follow the file's existing format and style conventions like dates, section titles, etc. +- Only add new changes (don't repeat existing entries) +- Be general, and avoid specific details, files, etc. The output should be minimal, no more than 3-4 short lines. +- Write only the new content to be added to CHANGELOG.md, without any introduction or summary. The content should appear as if it's a natural part of the existing file. + {%- if extra_instructions %} @@ -47,16 +49,19 @@ The PR Git Diff: {{ diff|trim }} ====== + Current date: ``` {{today}} ``` -The current CHANGELOG.md: + +The current 'CHANGELOG.md' file ====== {{ changelog_file_str }} ====== Response: +```markdown """ diff --git a/pr_agent/tools/pr_update_changelog.py b/pr_agent/tools/pr_update_changelog.py index b18a966c..79acf4f5 100644 --- a/pr_agent/tools/pr_update_changelog.py +++ b/pr_agent/tools/pr_update_changelog.py @@ -108,6 +108,13 @@ class PRUpdateChangelog: response, finish_reason = await self.ai_handler.chat_completion( model=model, system=system_prompt, user=user_prompt, temperature=get_settings().config.temperature) + # post-process the response + response = response.strip() + if response.startswith("```"): + response_lines = response.splitlines() + response_lines = response_lines[1:] + response = "\n".join(response_lines) + response = response.strip("`") return response def _prepare_changelog_update(self) -> Tuple[str, str]: