Skip to content

Add support for Anthropic Claude models via Google Vertex AI - #7097

Open
SrikarMannepalli wants to merge 5 commits into
microsoft:mainfrom
SrikarMannepalli:anthropic-vertex-client
Open

SrikarMannepalli wants to merge 5 commits into
microsoft:mainfrom
SrikarMannepalli:anthropic-vertex-client

Conversation

@SrikarMannepalli

Copy link
Copy Markdown
Contributor

Why are these changes needed?

This PR adds support for Anthropic Claude models via Google Vertex AI by introducing AnthropicVertexChatCompletionClient.

Background

While AutoGen already supports Anthropic Claude models through:

  • Direct API (AnthropicChatCompletionClient)
  • AWS Bedrock (AnthropicBedrockChatCompletionClient)

This PR add support for accessing Claude models through Vertex AI.

Changes Made

  1. New Client Class: AnthropicVertexChatCompletionClient following the same pattern as the existing Bedrock client
  2. Configuration Types: Added VertexInfo and related config models for GCP project/region configuration
  3. Tests: Added 11 comprehensive test cases covering initialization, serialization, config conversion, and mocked API calls
  4. Documentation: Added docstrings with usage examples and configuration loading patterns

Implementation Details

  • Uses Anthropic's official AsyncAnthropicVertex client
  • Requires project_id and region via VertexInfo configuration
  • Maintains consistency with existing AutoGen model client patterns
  • Supports all standard Claude model capabilities (vision, function calling, streaming)

Usage Example

from autogen_ext.models.anthropic import AnthropicVertexChatCompletionClient, VertexInfo

client = AnthropicVertexChatCompletionClient(
    model="claude-3-sonnet-20240229",
    vertex_info=VertexInfo(
        project_id="your-gcp-project-id",
        region="us-east5"
    )
)

Checks

@codecov

codecov Bot commented Oct 27, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.30%. Comparing base (13e144e) to head (dc93a88).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7097      +/-   ##
==========================================
+ Coverage   81.22%   81.30%   +0.07%     
==========================================
  Files         244      244              
  Lines       18512    18564      +52     
==========================================
+ Hits        15036    15093      +57     
+ Misses       3476     3471       -5     
Flag Coverage Δ
unittests 81.30% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SrikarMannepalli

Copy link
Copy Markdown
Contributor Author

Hi Eric Zhu (@ekzhu),
This change introduces support for Anthropic Claude models via Google Vertex AI along with tests.
I kindly request you to review the PR whenever you get a chance. Please let me know if there are any additional adjustments or clarifications you’d like.
Thanks so much for your time 🙏

@priteesshhh

Copy link
Copy Markdown

I analyzed this issue but couldn't identify the affected files. Could you please provide more details about which files need to be modified?

@SrikarMannepalli

Copy link
Copy Markdown
Contributor Author

I analyzed this issue but couldn't identify the affected files. Could you please provide more details about which files need to be modified?

This aims to add support for Anthropic Claude models via Google Vertex AI, and majorly affects the python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py file (in which a new class AnthropicVertexChatCompletionClient has been added) and its corresponding test.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants