Codium-ai / pr-agent

๐Ÿš€CodiumAI PR-Agent: An AI-Powered ๐Ÿค– Tool for Automated Pull Request Analysis, Feedback, Suggestions and More! ๐Ÿ’ป๐Ÿ”
Apache License 2.0
5.75k stars 534 forks source link

feat: claude 3.5 sonnet support #990

Closed s1moe2 closed 3 months ago

s1moe2 commented 3 months ago

User description

Adding Claude 3.5 Sonnet support. Not sure if this all it takes but I tried to check previous similar changes. Glad to add whatever else is necessary if I'm able and someone points me to it.

Tested locally with Docker:

[simoes@sl4 pr-agent]$ docker run --rm -it -e ANTHROPIC.KEY=... -e GITHUB.USER_TOKEN=github_pat_SECRET agent:latest --pr_url https://github.com/s1moe2/testrepo/pull/2 review
2024-06-21 09:01:14.109 | INFO     | pr_agent.tools.pr_reviewer:run:106 - Reviewing PR: https://github.com/s1moe2/testrepo/pull/2 ...
2024-06-21 09:01:16.716 | INFO     | pr_agent.algo.pr_processing:get_pr_diff:73 - PR main language: Go
2024-06-21 09:01:16.721 | INFO     | pr_agent.algo.pr_processing:get_pr_diff:83 - Tokens: 1481, total tokens under limit: 32000, returning full diff.
2024-06-21 09:01:21.183 | INFO     | pr_agent.tools.pr_reviewer:set_review_labels:396 - Setting review labels:
['Review effort [1-5]: 2']
[simoes@sl4 pr-agent]$ docker run --rm -it -e ANTHROPIC.KEY=... -e GITHUB.USER_TOKEN=github_pat_SECRET agent:latest --pr_url https://github.com/s1moe2/testrepo/pull/2 describe
2024-06-21 09:01:33.695 | INFO     | pr_agent.git_providers.git_provider:get_user_description:76 - Existing description was not generated by the pr-agent
2024-06-21 09:01:33.986 | INFO     | pr_agent.git_providers.git_provider:get_user_description:76 - Existing description was not generated by the pr-agent
2024-06-21 09:01:34.009 | INFO     | pr_agent.tools.pr_description:run:77 - Generating a PR description for pr_id: s1moe2/testrepo/2
2024-06-21 09:01:36.687 | INFO     | pr_agent.algo.pr_processing:get_pr_diff:73 - PR main language: Go
2024-06-21 09:01:36.692 | INFO     | pr_agent.algo.pr_processing:get_pr_diff:83 - Tokens: 1558, total tokens under limit: 32000, returning full diff.
[simoes@sl4 pr-agent]$ docker run --rm -it -e ANTHROPIC.KEY=... -e GITHUB.USER_TOKEN=github_pat_SECRET agent:latest --pr_url https://github.com/s1moe2/testrepo/pull/2 improve
2024-06-21 09:02:11.979 | INFO     | pr_agent.tools.pr_code_suggestions:__init__:35 - Setting max_model_tokens to 8000 for PR improve
2024-06-21 09:02:11.980 | INFO     | pr_agent.tools.pr_code_suggestions:_get_is_extended:342 - Extended mode is enabled automatically based on the configuration toggle
2024-06-21 09:02:12.288 | INFO     | pr_agent.tools.pr_code_suggestions:run:75 - Generating code suggestions for PR...
2024-06-21 09:02:14.973 | INFO     | pr_agent.tools.pr_code_suggestions:_prepare_prediction_extended:350 - Number of PR chunk calls: 1

PR Type

Enhancement


Description


Changes walkthrough ๐Ÿ“

Relevant files
Enhancement
__init__.py
Add support for Claude 3.5 Sonnet in token limits               

pr_agent/algo/__init__.py
  • Added support for anthropic/claude-3-5-sonnet-20240620 with a token
    limit of 100000.
  • +1/-0     

    ๐Ÿ’ก PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    codiumai-pr-agent-pro[bot] commented 3 months ago

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Reviewer Guide ๐Ÿ”

    โฑ๏ธ Estimated effort to review [1-5] 1
    ๐Ÿ… Score 95
    ๐Ÿงช Relevant tests No
    ๐Ÿ”’ Security concerns No
    ๐Ÿ”€ Multiple PR themes No
    โšก Key issues to review None
    codiumai-pr-agent-pro[bot] commented 3 months ago

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Code Suggestions โœจ

    CategorySuggestion                                                                                                                                    Score
    Maintainability
    Sort the keys in alphabetical order for better readability and maintainability ___ **Consider sorting the keys in alphabetical order to maintain consistency and improve
    readability. This will make it easier to locate specific entries in the future.** [pr_agent/algo/__init__.py [32-38]](https://github.com/Codium-ai/pr-agent/pull/990/files#diff-5923c546f24ec7308a0e43fc84bb6fe40de7bfe2ac6ee842da9578e5dc2c692bR32-R38) ```diff 'anthropic.claude-v1': 100000, 'anthropic.claude-v2': 100000, +'anthropic/claude-3-5-sonnet-20240620': 100000, 'anthropic/claude-3-opus-20240229': 100000, -'anthropic/claude-3-5-sonnet-20240620': 100000, 'bedrock/anthropic.claude-instant-v1': 100000, 'bedrock/anthropic.claude-v2': 100000, 'bedrock/anthropic.claude-v2:1': 100000, ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 7 Why: Sorting the keys alphabetically would indeed improve readability and maintainability, making it easier to locate and manage entries. The suggestion is relevant and correctly identifies the new code added in the PR.
    7
    mrT23 commented 3 months ago

    Looks good. i was able to generate: https://github.com/Codium-ai/pr-agent/pull/966#issuecomment-2165191329 with the new sonnet model image