-
Notifications
You must be signed in to change notification settings - Fork 524
Anthropic v2 #2330
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
base: main
Are you sure you want to change the base?
Anthropic v2 #2330
Conversation
📝 Documentation AnalysisJoggr found 1 outdated docs in the pull request. AutofixJoggr opened 1 pull request(s) to fix the outdated docs. Outdated
|
80706a7 to
84e0be1
Compare
|
@claude Review this PR. Summarize the features supported from Anthropic v2 client and compare with https://github.com/ag2ai/ag2/blob/main/autogen/oai/anthropic.py |
|
Claude finished @randombet's task in 1m 58s —— View job PR Review: Anthropic V2 Client ImplementationOverviewThis PR introduces a new Anthropic V2 Client ( Feature Comparison: V1 vs V2Architecture Differences
Shared Features (Both V1 and V2)Both implementations support: ✅ Native Structured Outputs (beta API for Claude Sonnet 4.5+)
✅ JSON Mode Fallback (for older models)
✅ Extended Thinking (thinking blocks)
✅ Tool/Function Calling
✅ Multiple Authentication Methods
✅ Message Conversion
✅ Cost Calculation
V2-Specific Advantages1. Typed Content BlocksV2 returns rich # V2 Response Structure
UnifiedResponse(
messages=[
UnifiedMessage(
role="assistant",
content=[
ReasoningContent(type="reasoning", reasoning="..."),
TextContent(type="text", text="..."),
ToolCallContent(type="tool_call", id="...", name="...", arguments="..."),
GenericContent(type="parsed", parsed={...}) # For structured outputs
]
)
]
)2. Access to Individual Content Typesresponse = client.create(params)
# Get reasoning blocks
for reasoning in response.messages[0].get_reasoning():
print(f"Thinking: {reasoning.reasoning}")
# Get text content
text = response.messages[0].get_text()
# Get tool calls
tool_calls = response.messages[0].get_tool_calls()3. Backward CompatibilityV2 provides # Get V1-style response when needed
chat_completion = client.create_v1_compatible(params)4. Forward CompatibilityV2 uses 5. Better Structured Output HandlingV2 handles structured outputs more cleanly:
Code Quality Review✅ Strengths
|
fix: docs
aa7bb3b to
d0cd398
Compare
Added front matter metadata with description and tags.
Codecov Report❌ Patch coverage is
... and 114 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Why are these changes needed?
This PR implements V2 client for anthropic
Related issue number
Checks