Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support models: Anthropic Claude 3 on Vertex AI #964

Merged
merged 1 commit into from
Jun 15, 2024

Conversation

evalphobia
Copy link
Contributor

@evalphobia evalphobia commented Jun 13, 2024

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

  • Added support for Anthropic Claude 3 models (Haiku, Sonnet, Opus) on Vertex AI with a token limit of 100000.
  • Updated dependencies to include anthropic[vertex]==0.21.3.
  • Updated litellm dependency to version 1.34.42.

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

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Jun 13, 2024

    PR Reviewer Guide 🔍

    (Review updated until commit b0f9b96)

    ⏱️ Estimated effort to review [1-5] 2
    🧪 Relevant tests No
    🔒 Security concerns No
    ⚡ Key issues to review None

    Copy link
    Contributor

    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]

    -'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]

    +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]

    +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]

    +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

    @@ -23,6 +23,9 @@
    'meta-llama/Llama-2-7b-chat-hf': 4096,
    'vertex_ai/codechat-bison': 6144,
    'vertex_ai/codechat-bison-32k': 32000,
    'vertex_ai/claude-3-haiku@20240307': 100000,
    'vertex_ai/claude-3-sonnet@20240229': 100000,
    'vertex_ai/claude-3-opus@20240229': 100000,
    Copy link
    Contributor Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    ... :100000

    Other existing claude settings use 100000, then I set 100000

    @@ -9,7 +10,7 @@ GitPython==3.1.32
    google-cloud-aiplatform==1.35.0
    google-cloud-storage==2.10.0
    Jinja2==3.1.2
    litellm==1.31.10
    litellm==1.34.42
    Copy link
    Contributor Author

    @evalphobia evalphobia Jun 13, 2024

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Initial version to support claude3 on vertex ai is v1.34.28.dev12.

    v1.34.42 is last version of v1.34.x and released on 11th April.

    We may update to v1.37.19 without any efforts.
    But if we update to v1.37.20, then we need to update openai's version.

    # error message to use litellm>=1.37.20
    
    ERROR: Cannot install pr-agent and pr-agent==0.2.2 because these package versions have conflicting dependencies.
    
    The conflict is caused by:
        pr-agent 0.2.2 depends on openai==1.13.3
        litellm 1.37.20 depends on openai>=1.27.0

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    v1.35.38 was worked fine, but v1.36.0 emits error in my env

    # v1.36.0
    
    ...
        from openai.types.beta.threads.message_content import MessageContent
    ModuleNotFoundError: No module named 'openai.types.beta.threads.message_content'

    @mrT23
    Copy link
    Collaborator

    mrT23 commented Jun 13, 2024

    Persistent review updated to latest commit b0f9b96

    @mrT23
    Copy link
    Collaborator

    mrT23 commented Jun 15, 2024

    looks good.

    @mrT23 mrT23 merged commit 774bba4 into Codium-ai:main Jun 15, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants