Skip to content

Commit b8d02c9

Browse files
authored
feat: Add missing Anthropic models (Claude Sonnet 4, Claude Opus 4) (#6585)
<!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number resolved #6584 ## Checks - [x] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [x] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [x] I've made sure all auto checks have passed.
1 parent db125fb commit b8d02c9

File tree

3 files changed

+67
-5
lines changed

3 files changed

+67
-5
lines changed

python/packages/autogen-core/src/autogen_core/models/_model_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class ModelFamily:
3838
CLAUDE_3_5_HAIKU = "claude-3-5-haiku"
3939
CLAUDE_3_5_SONNET = "claude-3-5-sonnet"
4040
CLAUDE_3_7_SONNET = "claude-3-7-sonnet"
41+
CLAUDE_4_OPUS = "claude-4-opus"
42+
CLAUDE_4_SONNET = "claude-4-sonnet"
4143
LLAMA_3_3_8B = "llama-3.3-8b"
4244
LLAMA_3_3_70B = "llama-3.3-70b"
4345
LLAMA_4_SCOUT = "llama-4-scout"
@@ -73,6 +75,8 @@ class ModelFamily:
7375
"claude-3-5-haiku",
7476
"claude-3-5-sonnet",
7577
"claude-3-7-sonnet",
78+
"claude-4-opus",
79+
"claude-4-sonnet",
7680
# llama_models
7781
"llama-3.3-8b",
7882
"llama-3.3-70b",
@@ -100,6 +104,8 @@ def is_claude(family: str) -> bool:
100104
ModelFamily.CLAUDE_3_5_HAIKU,
101105
ModelFamily.CLAUDE_3_5_SONNET,
102106
ModelFamily.CLAUDE_3_7_SONNET,
107+
ModelFamily.CLAUDE_4_OPUS,
108+
ModelFamily.CLAUDE_4_SONNET,
103109
)
104110

105111
@staticmethod

python/packages/autogen-ext/src/autogen_ext/models/anthropic/_model_info.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,42 @@
66
# For Anthropic's Claude models based on:
77
# https://docs.anthropic.com/claude/docs/models-overview
88
_MODEL_INFO: Dict[str, ModelInfo] = {
9+
# Claude 4 Opus
10+
"claude-opus-4-20250514": {
11+
"vision": True,
12+
"function_calling": True,
13+
"json_output": True,
14+
"family": ModelFamily.CLAUDE_4_OPUS,
15+
"structured_output": False,
16+
"multiple_system_messages": False,
17+
},
18+
# Claude 4 Opus latest alias
19+
"claude-opus-4-0": {
20+
"vision": True,
21+
"function_calling": True,
22+
"json_output": True,
23+
"family": ModelFamily.CLAUDE_4_OPUS,
24+
"structured_output": False,
25+
"multiple_system_messages": False,
26+
},
27+
# Claude 4 Sonnet
28+
"claude-sonnet-4-20250514": {
29+
"vision": True,
30+
"function_calling": True,
31+
"json_output": True,
32+
"family": ModelFamily.CLAUDE_4_SONNET,
33+
"structured_output": False,
34+
"multiple_system_messages": False,
35+
},
36+
# Claude 4 Sonnet latest alias
37+
"claude-sonnet-4-0": {
38+
"vision": True,
39+
"function_calling": True,
40+
"json_output": True,
41+
"family": ModelFamily.CLAUDE_4_SONNET,
42+
"structured_output": False,
43+
"multiple_system_messages": False,
44+
},
945
# Claude 3.7 Sonnet
1046
"claude-3-7-sonnet-20250219": {
1147
"vision": True,

python/packages/autogen-ext/src/autogen_ext/models/openai/_model_info.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
"claude-3-5-haiku": "claude-3-5-haiku-20241022",
3737
"claude-3-5-sonnet": "claude-3-5-sonnet-20241022",
3838
"claude-3-7-sonnet": "claude-3-7-sonnet-20250219",
39+
"claude-4-sonnet": "claude-sonnet-4-20250514",
40+
"claude-4-opus": "claude-opus-4-20250514",
3941
# Llama models
4042
"llama-3.3-8b": "Llama-3.3-8B-Instruct",
4143
"llama-3.3-70b": "Llama-3.3-70B-Instruct",
@@ -364,6 +366,22 @@
364366
"structured_output": False,
365367
"multiple_system_messages": True,
366368
},
369+
"claude-sonnet-4-20250514": {
370+
"vision": True,
371+
"function_calling": True,
372+
"json_output": False, # Update this when Anthropic supports structured output
373+
"family": ModelFamily.CLAUDE_4_SONNET,
374+
"structured_output": False,
375+
"multiple_system_messages": True,
376+
},
377+
"claude-opus-4-20250514": {
378+
"vision": True,
379+
"function_calling": True,
380+
"json_output": False, # Update this when Anthropic supports structured output
381+
"family": ModelFamily.CLAUDE_4_OPUS,
382+
"structured_output": False,
383+
"multiple_system_messages": True,
384+
},
367385
"Llama-3.3-8B-Instruct": {
368386
"vision": False,
369387
"function_calling": True,
@@ -432,11 +450,13 @@
432450
"gemini-2.5-pro-preview-03-25": 2097152,
433451
"gemini-2.5-flash-preview-05-20": 1048576,
434452
"claude-3-haiku-20240307": 50000,
435-
"claude-3-sonnet-20240229": 40000,
436-
"claude-3-opus-20240229": 20000,
437-
"claude-3-5-haiku-20241022": 50000,
438-
"claude-3-5-sonnet-20241022": 40000,
439-
"claude-3-7-sonnet-20250219": 20000,
453+
"claude-3-sonnet-20240229": 200000,
454+
"claude-3-opus-20240229": 200000,
455+
"claude-3-5-haiku-20241022": 200000,
456+
"claude-3-5-sonnet-20241022": 200000,
457+
"claude-3-7-sonnet-20250219": 200000,
458+
"claude-sonnet-4-20250514": 200000,
459+
"claude-opus-4-20250514": 200000,
440460
"Llama-3.3-8B-Instruct": 128000,
441461
"Llama-3.3-70B-Instruct": 128000,
442462
"Llama-4-Scout-17B-16E-Instruct-FP8": 128000,

0 commit comments

Comments
 (0)