🐫 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
feat: support claude 4.1 (#2988)
Wendong-Fan3d9c6f3e6fd8
diff --git a/camel/types/enums.py b/camel/types/enums.pyindex dc51673c5..ef27e4e00 100644--- a/camel/types/enums.py+++ b/camel/types/enums.py@@ -59,6 +59,7 @@ class ModelType(UnifiedModelType, Enum):AWS_LLAMA_3_2_11B_INSTRUCT = "us.meta.llama3-2-11b-instruct-v1:0"AWS_CLAUDE_SONNET_4 = "anthropic.claude-sonnet-4-20250514-v1:0"AWS_CLAUDE_OPUS_4 = "anthropic.claude-opus-4-20250514-v1:0"+ AWS_CLAUDE_OPUS_4_1 = "anthropic.claude-opus-4-1-20250805-v1:0"GLM_4 = "glm-4"GLM_4V = "glm-4v"@@ -158,6 +159,7 @@ class ModelType(UnifiedModelType, Enum):CLAUDE_3_7_SONNET = "claude-3-7-sonnet-latest"CLAUDE_SONNET_4 = "claude-sonnet-4-20250514"CLAUDE_OPUS_4 = "claude-opus-4-20250514"+ CLAUDE_OPUS_4_1 = "claude-opus-4-1-20250805"# Netmind modelsNETMIND_LLAMA_4_MAVERICK_17B_128E_INSTRUCT = (@@ -514,6 +516,7 @@ class ModelType(UnifiedModelType, Enum):ModelType.AWS_LLAMA_3_2_11B_INSTRUCT,ModelType.AWS_CLAUDE_SONNET_4,ModelType.AWS_CLAUDE_OPUS_4,+ ModelType.AWS_CLAUDE_OPUS_4_1,}@property@@ -578,6 +581,7 @@ class ModelType(UnifiedModelType, Enum):ModelType.CLAUDE_3_7_SONNET,ModelType.CLAUDE_SONNET_4,ModelType.CLAUDE_OPUS_4,+ ModelType.CLAUDE_OPUS_4_1,}@property@@ -1264,6 +1268,7 @@ class ModelType(UnifiedModelType, Enum):ModelType.CLAUDE_3_7_SONNET,ModelType.CLAUDE_SONNET_4,ModelType.CLAUDE_OPUS_4,+ ModelType.CLAUDE_OPUS_4_1,ModelType.YI_MEDIUM_200K,ModelType.AWS_CLAUDE_3_5_SONNET,ModelType.AWS_CLAUDE_3_HAIKU,@@ -1271,6 +1276,7 @@ class ModelType(UnifiedModelType, Enum):ModelType.AWS_CLAUDE_3_7_SONNET,ModelType.AWS_CLAUDE_SONNET_4,ModelType.AWS_CLAUDE_OPUS_4,+ ModelType.AWS_CLAUDE_OPUS_4_1,ModelType.O4_MINI,ModelType.O3,}:diff --git a/examples/models/anthiropic_model_example.py b/examples/models/anthiropic_model_example.pyindex 2cc68129f..e1b581d67 100644--- a/examples/models/anthiropic_model_example.py+++ b/examples/models/anthiropic_model_example.py@@ -229,3 +229,62 @@ which more generally states that for any arithmetic progression an + b wheregcd(a,b) = 1, there are infinitely many primes in that progression.===============================================================================""" # noqa: RUF001+++model = ModelFactory.create(+ model_platform=ModelPlatformType.ANTHROPIC,+ model_type=ModelType.CLAUDE_OPUS_4_1,+ model_config_dict={+ "extra_body": {"thinking": {"type": "enabled", "budget_tokens": 2000}}+ },+)++camel_agent = ChatAgent(model=model)++user_msg = """Are there an infinite number of prime numbers such that n mod 4+== 3?"""++response = camel_agent.step(user_msg)+print(response.msgs[0].content)++"""+===============================================================================+Yes, there are infinitely many prime numbers p such that p ≡ 3 (mod 4).++Here's a proof by contradiction:++**Proof:**++Suppose there are only finitely many primes ≡ 3 (mod 4). Let's call them p₁,+p₂, ..., pₙ.++Consider the number:+**N = 4p₁p₂···pₙ - 1**++Key observations about N:+1. **N ≡ 3 (mod 4)** since N = 4(p₁p₂···pₙ) - 1+2. N is odd (so 2 doesn't divide N)+3. None of the primes p₁, p₂, ..., pₙ divide N (if pᵢ divided N, then pᵢ would+divide N - 4p₁p₂···pₙ = -1, which is impossible)++Now, N must have prime factorization. Every odd prime is either ≡ 1 (mod 4) or+≡ 3 (mod 4).++**Crucial fact:** The product of numbers that are all ≡ 1 (mod 4) is also ≡ 1+(mod 4).++Since N ≡ 3 (mod 4), not all of its prime factors can be ≡ 1 (mod 4).+Therefore, N must have at least one prime factor q where q ≡ 3 (mod 4).++But we established that none of p₁, p₂, ..., pₙ divide N, so q must be a prime+≡ 3 (mod 4) that's not in our supposedly complete list. This is a+contradiction!++Therefore, there must be infinitely many primes ≡ 3 (mod 4).++This same argument structure can also prove there are infinitely many primes ≡+2 (mod 3), but interestingly, it *cannot* directly prove there are infinitely+many primes ≡ 1 (mod 4) (that requires Dirichlet's theorem on primes in+arithmetic progressions).+===============================================================================+"""