Skip to content

Conversation

@SrikarMannepalli
Copy link
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
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.30%. Comparing base (13e144e) to head (dc93a88).

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 Sentry.
📢 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
Contributor Author

Hi @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 🙏

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.

1 participant