š« CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
fix: agent test, remove deprecated claude model (#3772)
Wendong-Faneed7320daa44
diff --git a/camel/types/enums.py b/camel/types/enums.pyindex f916aa859..c2d865477 100644--- a/camel/types/enums.py+++ b/camel/types/enums.py@@ -212,8 +212,6 @@ class ModelType(UnifiedModelType, Enum):STUB = "stub"# Claude models- CLAUDE_3_HAIKU = "claude-3-haiku-20240307"- CLAUDE_3_5_HAIKU = "claude-3-5-haiku-latest"CLAUDE_3_7_SONNET = "claude-3-7-sonnet-latest"CLAUDE_SONNET_4_5 = "claude-sonnet-4-5"CLAUDE_OPUS_4_5 = "claude-opus-4-5"@@ -701,8 +699,6 @@ class ModelType(UnifiedModelType, Enum):bool: Whether this type of models is anthropic."""return self in {- ModelType.CLAUDE_3_HAIKU,- ModelType.CLAUDE_3_5_HAIKU,ModelType.CLAUDE_3_7_SONNET,ModelType.CLAUDE_SONNET_4_5,ModelType.CLAUDE_OPUS_4_5,@@ -1542,8 +1538,6 @@ class ModelType(UnifiedModelType, Enum):ModelType.O1,ModelType.O3_MINI,ModelType.O3_PRO,- ModelType.CLAUDE_3_HAIKU,- ModelType.CLAUDE_3_5_HAIKU,ModelType.CLAUDE_3_7_SONNET,ModelType.CLAUDE_SONNET_4_5,ModelType.CLAUDE_OPUS_4_5,diff --git a/docs/key_modules/models.md b/docs/key_modules/models.mdindex 043d287ae..f9686ab0b 100644--- a/docs/key_modules/models.md+++ b/docs/key_modules/models.md@@ -40,7 +40,7 @@ CAMEL supports a wide range of models, including [OpenAIās GPT series](https:/| **Azure OpenAI** | gpt-4o, gpt-4-turbo<br/>gpt-4, gpt-3.5-turbo || **Mistral AI** | mistral-large-latest, pixtral-12b-2409<br/>ministral-8b-latest, ministral-3b-latest<br/>open-mistral-nemo, codestral-latest<br/>open-mistral-7b, open-mixtral-8x7b<br/>open-mixtral-8x22b, open-codestral-mamba<br/>mistral-small-2506, mistral-medium-2508<br/>magistral-small-1.2, magistral-medium-1.2 || **Moonshot** | moonshot-v1-8k<br/>moonshot-v1-32k<br/>moonshot-v1-128k |-| **Anthropic** | claude-2.1, claude-2.0, claude-instant-1.2<br/>claude-3-opus-latest, claude-3-sonnet-20240229, claude-3-haiku-20240307<br/>claude-3-5-sonnet-latest, claude-3-5-haiku-latest, claude-3-7-sonnet-latest<br/>claude-sonnet-4-5, claude-sonnet-4-20250514, claude-opus-4-20250514, claude-opus-4-1-20250805 |+| **Anthropic** | claude-3-7-sonnet-latest<br/>claude-sonnet-4-5, claude-opus-4-5, claude-haiku-4-5<br/>claude-sonnet-4-20250514, claude-opus-4-20250514, claude-opus-4-1-20250805 || **Gemini** | gemini-3-pro-preview, gemini-3-flash-preview<br/>gemini-2.5-pro, gemini-2.5-flash<br/>gemini-2.0-flash, gemini-2.0-flash-thinking-exp<br/> gemini-2.0-flash-lite|| **Lingyiwanwu** | yi-lightning, yi-large, yi-medium<br/>yi-large-turbo, yi-vision, yi-medium-200k<br/>yi-spark, yi-large-rag, yi-large-fc || **Qwen** | qwen3-coder-plus, qwq-32b-preview, qwq-plus, qvq-72b-preview, qwen-max, qwen-plus, qwen-turbo, qwen-long<br/>qwen-plus-latest, qwen-plus-2025-04-28, qwen-turbo-latest, qwen-turbo-2025-04-28<br/>qwen-vl-max, qwen-vl-plus, qwen-vl-72b-instruct, qwen-math-plus, qwen-math-turbo, qwen-coder-turbo<br/>qwen2.5-coder-32b-instruct, qwen2.5-72b-instruct, qwen2.5-32b-instruct, qwen2.5-14b-instruct |diff --git a/docs/mintlify/key_modules/models.mdx b/docs/mintlify/key_modules/models.mdxindex 043d287ae..f9686ab0b 100644--- a/docs/mintlify/key_modules/models.mdx+++ b/docs/mintlify/key_modules/models.mdx@@ -40,7 +40,7 @@ CAMEL supports a wide range of models, including [OpenAIās GPT series](https:/| **Azure OpenAI** | gpt-4o, gpt-4-turbo<br/>gpt-4, gpt-3.5-turbo || **Mistral AI** | mistral-large-latest, pixtral-12b-2409<br/>ministral-8b-latest, ministral-3b-latest<br/>open-mistral-nemo, codestral-latest<br/>open-mistral-7b, open-mixtral-8x7b<br/>open-mixtral-8x22b, open-codestral-mamba<br/>mistral-small-2506, mistral-medium-2508<br/>magistral-small-1.2, magistral-medium-1.2 || **Moonshot** | moonshot-v1-8k<br/>moonshot-v1-32k<br/>moonshot-v1-128k |-| **Anthropic** | claude-2.1, claude-2.0, claude-instant-1.2<br/>claude-3-opus-latest, claude-3-sonnet-20240229, claude-3-haiku-20240307<br/>claude-3-5-sonnet-latest, claude-3-5-haiku-latest, claude-3-7-sonnet-latest<br/>claude-sonnet-4-5, claude-sonnet-4-20250514, claude-opus-4-20250514, claude-opus-4-1-20250805 |+| **Anthropic** | claude-3-7-sonnet-latest<br/>claude-sonnet-4-5, claude-opus-4-5, claude-haiku-4-5<br/>claude-sonnet-4-20250514, claude-opus-4-20250514, claude-opus-4-1-20250805 || **Gemini** | gemini-3-pro-preview, gemini-3-flash-preview<br/>gemini-2.5-pro, gemini-2.5-flash<br/>gemini-2.0-flash, gemini-2.0-flash-thinking-exp<br/> gemini-2.0-flash-lite|| **Lingyiwanwu** | yi-lightning, yi-large, yi-medium<br/>yi-large-turbo, yi-vision, yi-medium-200k<br/>yi-spark, yi-large-rag, yi-large-fc || **Qwen** | qwen3-coder-plus, qwq-32b-preview, qwq-plus, qvq-72b-preview, qwen-max, qwen-plus, qwen-turbo, qwen-long<br/>qwen-plus-latest, qwen-plus-2025-04-28, qwen-turbo-latest, qwen-turbo-2025-04-28<br/>qwen-vl-max, qwen-vl-plus, qwen-vl-72b-instruct, qwen-math-plus, qwen-math-turbo, qwen-coder-turbo<br/>qwen2.5-coder-32b-instruct, qwen2.5-72b-instruct, qwen2.5-32b-instruct, qwen2.5-14b-instruct |diff --git a/examples/agents/create_chat_agent.py b/examples/agents/create_chat_agent.pyindex d9ad9fdc8..bd62e08a4 100644--- a/examples/agents/create_chat_agent.py+++ b/examples/agents/create_chat_agent.py@@ -29,7 +29,7 @@ agent_2 = ChatAgent(# Method 3: Initialize the agent with a tuple (platform, model)agent_3 = ChatAgent("You are a helpful assistant.",- model=("anthropic", "claude-3-5-sonnet-latest"),+ model=("anthropic", "claude-sonnet-4-5"),)# Method 4: Initialize the agent with a `tuple` of `enum`@@ -56,7 +56,7 @@ model = ModelFactory.create(agent_7 = ChatAgent("You are a helpful assistant.", model=model)-# Test with a simple question with agent3(Anthropic, claude-3-5-sonnet-latest)+# Test with a simple question with agent3(Anthropic, claude-sonnet-4-5)user_msg = "Which model are you?"# Get the response from one of the agentsdiff --git a/examples/models/anthropic_model_example.py b/examples/models/anthropic_model_example.pyindex ec15a1508..a3dbec0bb 100644--- a/examples/models/anthropic_model_example.py+++ b/examples/models/anthropic_model_example.py@@ -148,7 +148,7 @@ def my_add(a: int, b: int) -> int:anthropic_model = ModelFactory.create(model_platform=ModelPlatformType.ANTHROPIC,- model_type=ModelType.CLAUDE_3_5_HAIKU,+ model_type=ModelType.CLAUDE_HAIKU_4_5,model_config_dict=AnthropicConfig(temperature=0.2).as_dict(),)diff --git a/test/agents/test_chat_agent.py b/test/agents/test_chat_agent.pyindex d6a9a08fd..bd654452c 100644--- a/test/agents/test_chat_agent.py+++ b/test/agents/test_chat_agent.py@@ -1387,21 +1387,21 @@ def test_chat_agent_creation_methods():# Method 3: Initialize with a tuple of strings (platform, model)agent_3 = ChatAgent("You are a helpful assistant.",- model=("anthropic", "claude-3-5-sonnet-latest"),+ model=("anthropic", "claude-3-7-sonnet-latest"),)- assert agent_3.model_type.value == "claude-3-5-sonnet-latest"+ assert agent_3.model_type.value == "claude-3-7-sonnet-latest"assert (agent_3.model_backend.models[0].model_type.value- == "claude-3-5-sonnet-latest"+ == "claude-3-7-sonnet-latest")assert isinstance(agent_3.model_backend.models[0], AnthropicModel)# Method 4: Initialize with a tuple of enumsagent_4 = ChatAgent("You are a helpful assistant.",- model=(ModelPlatformType.ANTHROPIC, ModelType.CLAUDE_3_HAIKU),+ model=(ModelPlatformType.ANTHROPIC, ModelType.CLAUDE_HAIKU_4_5),)- assert agent_4.model_type.value == "claude-3-5-sonnet-latest"+ assert agent_4.model_type.value == "claude-haiku-4-5"assert isinstance(agent_4.model_backend.models[0], AnthropicModel)# Method 5: Default model when none is specifieddiff --git a/test/models/test_anthropic_model.py b/test/models/test_anthropic_model.pyindex 2a8d4945e..2d1d8542c 100644--- a/test/models/test_anthropic_model.py+++ b/test/models/test_anthropic_model.py@@ -32,11 +32,10 @@ pytest.importorskip("anthropic", reason="anthropic package is required")@pytest.mark.parametrize("model_type",[- ModelType.CLAUDE_3_HAIKU,- ModelType.CLAUDE_3_5_HAIKU,ModelType.CLAUDE_3_7_SONNET,ModelType.CLAUDE_SONNET_4_5,ModelType.CLAUDE_OPUS_4_5,+ ModelType.CLAUDE_HAIKU_4_5,ModelType.CLAUDE_SONNET_4,ModelType.CLAUDE_OPUS_4,ModelType.CLAUDE_OPUS_4_1,@@ -64,7 +63,7 @@ def test_anthropic_model_uses_provided_token_counter():token_counter = DummyTokenCounter()model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,model_config_dict=AnthropicConfig().as_dict(),api_key="dummy_api_key",token_counter=token_counter,@@ -77,7 +76,7 @@ def test_anthropic_model_cache_control_valid_and_invalid():# Valid cache_control values should configure _cache_control_configmodel_config = AnthropicConfig(cache_control="5m").as_dict()model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,model_config_dict=model_config,api_key="dummy_api_key",)@@ -90,7 +89,7 @@ def test_anthropic_model_cache_control_valid_and_invalid():with pytest.raises(ValueError):invalid_config = AnthropicConfig(cache_control="10m").as_dict()AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,model_config_dict=invalid_config,api_key="dummy_api_key",)@@ -99,7 +98,7 @@ def test_anthropic_model_cache_control_valid_and_invalid():def test_anthropic_model_cache_control_from_config():model_config = AnthropicConfig(cache_control="1h").as_dict()model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,model_config_dict=model_config,api_key="dummy_api_key",)@@ -111,14 +110,14 @@ def test_anthropic_model_cache_control_from_config():def test_anthropic_model_stream_property():model_stream = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,model_config_dict={"stream": True},api_key="dummy_api_key",)assert model_stream.stream is Truemodel_non_stream = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,model_config_dict={"stream": False},api_key="dummy_api_key",)@@ -186,7 +185,7 @@ def test_strip_trailing_whitespace_none_content():def test_convert_openai_to_anthropic_system_message():"""Test conversion of system message."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)messages = [@@ -207,7 +206,7 @@ def test_convert_openai_to_anthropic_system_message():def test_convert_openai_to_anthropic_system_message_list_content():"""Test conversion of system message with list content."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)messages = [@@ -231,7 +230,7 @@ def test_convert_openai_to_anthropic_system_message_list_content():def test_convert_openai_to_anthropic_tool_calls():"""Test conversion of assistant message with tool calls."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)messages = [@@ -267,7 +266,7 @@ def test_convert_openai_to_anthropic_tool_calls():def test_convert_openai_to_anthropic_tool_response():"""Test conversion of tool response message."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)messages = [@@ -292,7 +291,7 @@ def test_convert_openai_to_anthropic_tool_response():def test_convert_anthropic_response_text_only():"""Test conversion of text-only response."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -309,7 +308,7 @@ def test_convert_anthropic_response_text_only():mock_response.usage.output_tokens = 5result = model._convert_anthropic_to_openai_response(- mock_response, "claude-3-haiku"+ mock_response, "claude-haiku-4-5")assert result.choices[0].message.content == "Hello, how can I help?"@@ -323,7 +322,7 @@ def test_convert_anthropic_response_text_only():def test_convert_anthropic_response_with_tool_use():"""Test conversion of response with tool use."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -347,7 +346,7 @@ def test_convert_anthropic_response_with_tool_use():mock_response.usage.output_tokens = 5result = model._convert_anthropic_to_openai_response(- mock_response, "claude-3-haiku"+ mock_response, "claude-haiku-4-5")assert result.choices[0].message.content == "I'll search for that."@@ -362,7 +361,7 @@ def test_convert_anthropic_response_with_tool_use():def test_convert_anthropic_response_stop_reasons():"""Test conversion of different stop reasons."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -383,7 +382,7 @@ def test_convert_anthropic_response_stop_reasons():mock_response.usage.output_tokens = 0result = model._convert_anthropic_to_openai_response(- mock_response, "claude-3-haiku"+ mock_response, "claude-haiku-4-5")assert result.choices[0].finish_reason == openai_reason@@ -391,7 +390,7 @@ def test_convert_anthropic_response_stop_reasons():def test_convert_tools_none():"""Test conversion of None tools."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -402,7 +401,7 @@ def test_convert_tools_none():def test_convert_tools_empty():"""Test conversion of empty tools list."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -413,7 +412,7 @@ def test_convert_tools_empty():def test_convert_tools_basic():"""Test basic tool conversion."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -445,7 +444,7 @@ def test_convert_tools_basic():def test_convert_tools_with_beta_structured_outputs():"""Test tool conversion with beta structured outputs enabled."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",use_beta_for_structured_outputs=True,)@@ -470,7 +469,7 @@ def test_convert_tools_with_beta_structured_outputs():def test_convert_stream_chunk_message_start():"""Test conversion of message_start chunk."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -481,7 +480,7 @@ def test_convert_stream_chunk_message_start():tool_call_index = {}result = model._convert_anthropic_stream_to_openai_chunk(- mock_chunk, "claude-3-haiku", tool_call_index+ mock_chunk, "claude-haiku-4-5", tool_call_index)assert result.id == "msg_123"@@ -492,7 +491,7 @@ def test_convert_stream_chunk_message_start():def test_convert_stream_chunk_content_block_delta_text():"""Test conversion of text content_block_delta chunk."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -504,7 +503,7 @@ def test_convert_stream_chunk_content_block_delta_text():tool_call_index = {}result = model._convert_anthropic_stream_to_openai_chunk(- mock_chunk, "claude-3-haiku", tool_call_index+ mock_chunk, "claude-haiku-4-5", tool_call_index)assert result.choices[0].delta.content == "Hello"@@ -513,7 +512,7 @@ def test_convert_stream_chunk_content_block_delta_text():def test_convert_stream_chunk_tool_use_start():"""Test conversion of tool_use content_block_start chunk."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -526,7 +525,7 @@ def test_convert_stream_chunk_tool_use_start():tool_call_index = {}result = model._convert_anthropic_stream_to_openai_chunk(- mock_chunk, "claude-3-haiku", tool_call_index+ mock_chunk, "claude-haiku-4-5", tool_call_index)assert result.choices[0].delta.tool_calls is not None@@ -542,7 +541,7 @@ def test_convert_stream_chunk_tool_use_start():def test_convert_stream_chunk_tool_use_delta():"""Test conversion of tool_use input_json_delta chunk."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -559,7 +558,7 @@ def test_convert_stream_chunk_tool_use_delta():tool_call_index = {"tool_123": 0}result = model._convert_anthropic_stream_to_openai_chunk(- mock_chunk, "claude-3-haiku", tool_call_index+ mock_chunk, "claude-haiku-4-5", tool_call_index)assert result.choices[0].delta.tool_calls is not None@@ -570,7 +569,7 @@ def test_convert_stream_chunk_tool_use_delta():def test_convert_stream_chunk_message_delta_stop():"""Test conversion of message_delta chunk with stop reason."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -581,7 +580,7 @@ def test_convert_stream_chunk_message_delta_stop():tool_call_index = {}result = model._convert_anthropic_stream_to_openai_chunk(- mock_chunk, "claude-3-haiku", tool_call_index+ mock_chunk, "claude-haiku-4-5", tool_call_index)assert result.choices[0].finish_reason == "stop"@@ -590,7 +589,7 @@ def test_convert_stream_chunk_message_delta_stop():def test_convert_stream_chunk_message_stop():"""Test conversion of message_stop chunk."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",)@@ -599,7 +598,7 @@ def test_convert_stream_chunk_message_stop():tool_call_index = {}result = model._convert_anthropic_stream_to_openai_chunk(- mock_chunk, "claude-3-haiku", tool_call_index+ mock_chunk, "claude-haiku-4-5", tool_call_index)assert result.choices[0].finish_reason == "stop"@@ -608,7 +607,7 @@ def test_convert_stream_chunk_message_stop():def test_use_beta_for_structured_outputs():"""Test that beta API is used when configured."""model = AnthropicModel(- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,api_key="dummy_api_key",use_beta_for_structured_outputs=True,)diff --git a/test/models/test_config_file/json_configs/claude_3_haiku_config.json b/test/models/test_config_file/json_configs/claude_haiku_4_5_config.jsonsimilarity index 84%rename from test/models/test_config_file/json_configs/claude_3_haiku_config.jsonrename to test/models/test_config_file/json_configs/claude_haiku_4_5_config.jsonindex 64b595931..3eddd140b 100644--- a/test/models/test_config_file/json_configs/claude_3_haiku_config.json+++ b/test/models/test_config_file/json_configs/claude_haiku_4_5_config.json@@ -1,6 +1,6 @@{"model_platform": "anthropic",- "model_type": "claude-3-haiku-20240307",+ "model_type": "claude-haiku-4-5","model_config_dict": {"temperature": 0.6,"max_tokens": 2000diff --git a/test/models/test_model_factory.py b/test/models/test_model_factory.pyindex 3a5f0f353..c122ea4e2 100644--- a/test/models/test_model_factory.py+++ b/test/models/test_model_factory.py@@ -82,15 +82,15 @@ parameterize_token_counter = pytest.mark.parametrize(# Anthropic model uses AnthropicTokenCounter as default(ModelPlatformType.ANTHROPIC,- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,AnthropicConfig().as_dict(),None,AnthropicTokenCounter,- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,),(ModelPlatformType.ANTHROPIC,- ModelType.CLAUDE_3_HAIKU,+ ModelType.CLAUDE_HAIKU_4_5,AnthropicConfig().as_dict(),OpenAITokenCounter(ModelType.GPT_3_5_TURBO),OpenAITokenCounter,