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

Support models: Anthropic Claude 3 on Vertex AI #964

Closed evalphobia closed 3 months ago

evalphobia commented 3 months ago

User description

This PR enables to use Claude 3 models (Haiku, Sonnet, Opus) on Vertex AI Model Garden.

Model names and versions are picked from LiteLLM, https://github.com/BerriAI/litellm/blob/4bf33ef26732374668096b9c3b5c77d0a3345c58/docs/my-website/docs/providers/vertex.md#anthropic

Model descriptions (just for ref):


PR Type

enhancement, dependencies


Description


Changes walkthrough ๐Ÿ“

Relevant files
Enhancement
__init__.py
Add support for Claude 3 models on Vertex AI                         

pr_agent/algo/__init__.py
  • Added support for vertex_ai/claude-3-haiku@20240307,
    vertex_ai/claude-3-sonnet@20240229, and
    vertex_ai/claude-3-opus@20240229 with a token limit of 100000.
  • +3/-0     
    Dependencies
    requirements.txt
    Update dependencies for Anthropic Claude 3 support             

    requirements.txt
  • Added anthropic[vertex]==0.21.3 dependency.
  • Updated litellm dependency to version 1.34.42.
  • +2/-1     

    ๐Ÿ’ก 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 Reviewer Guide ๐Ÿ”

    (Review updated until commit https://github.com/Codium-ai/pr-agent/commit/b0f9b96c7553ff20250e88c2e4565a223b491306)

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

    PR Code Suggestions โœจ

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Use a consistent date format for model identifiers ___ **Consider using a consistent date format for the model identifiers to avoid potential
    confusion and errors. The current format mixes different date formats (e.g., @20240307 and
    @20240229).** [pr_agent/algo/__init__.py [26-28]](https://github.com/Codium-ai/pr-agent/pull/964/files#diff-5923c546f24ec7308a0e43fc84bb6fe40de7bfe2ac6ee842da9578e5dc2c692bR26-R28) ```diff -'vertex_ai/claude-3-haiku@20240307': 100000, -'vertex_ai/claude-3-sonnet@20240229': 100000, -'vertex_ai/claude-3-opus@20240229': 100000, +'vertex_ai/claude-3-haiku@2024-03-07': 100000, +'vertex_ai/claude-3-sonnet@2024-02-29': 100000, +'vertex_ai/claude-3-opus@2024-02-29': 100000, ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 8 Why: The suggestion correctly identifies a potential source of confusion due to inconsistent date formats in the model identifiers, which can lead to errors in processing or understanding the data.
    8
    Pin the anthropic[vertex] package to a specific version for stability ___ **Consider pinning the anthropic[vertex] package to a more specific version if you encounter
    any issues with future updates, to ensure stability.** [requirements.txt [2]](https://github.com/Codium-ai/pr-agent/pull/964/files#diff-4d7c51b1efe9043e44439a949dfd92e5827321b34082903477fd04876edb7552R2-R2) ```diff +anthropic[vertex]==0.21.3 - ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 6 Why: Pinning dependencies can indeed help maintain stability, especially in production environments. The suggestion is relevant but not critical unless specific version-related issues have been identified.
    6
    Possible issue
    Verify compatibility of the new anthropic[vertex]==0.21.3 package with existing dependencies ___ **Ensure that the anthropic[vertex]==0.21.3 package is compatible with the rest of the
    dependencies, especially google-cloud-aiplatform==1.35.0 and litellm==1.34.42, to avoid
    potential dependency conflicts.** [requirements.txt [2-13]](https://github.com/Codium-ai/pr-agent/pull/964/files#diff-4d7c51b1efe9043e44439a949dfd92e5827321b34082903477fd04876edb7552R2-R13) ```diff +anthropic[vertex]==0.21.3 +google-cloud-aiplatform==1.35.0 +litellm==1.34.42 - ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 7 Why: This is a valid concern as new package versions can introduce compatibility issues with existing dependencies. However, without specific evidence of incompatibility, the suggestion is precautionary.
    7
    Maintainability
    Remove redundant litellm entry if not needed ___ **Remove the redundant litellm entry if it is no longer needed, as it was updated from
    1.31.10 to 1.34.42.** [requirements.txt [13]](https://github.com/Codium-ai/pr-agent/pull/964/files#diff-4d7c51b1efe9043e44439a949dfd92e5827321b34082903477fd04876edb7552R13-R13) ```diff +litellm==1.34.42 - ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 5 Why: The suggestion misunderstands the PR change; the `litellm` package was updated, not made redundant. The suggestion is not applicable as the entry is still required, just at a new version.
    5
    mrT23 commented 3 months ago

    Persistent review updated to latest commit https://github.com/Codium-ai/pr-agent/commit/b0f9b96c7553ff20250e88c2e4565a223b491306

    mrT23 commented 3 months ago

    looks good.