Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

feat: Support Claude Opus 4.5 (#3450)

Wendong-Fan33427e18b1ea
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 61fdbb5fb..6525a1cf8 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -216,6 +216,7 @@ class ModelType(UnifiedModelType, Enum):
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"
CLAUDE_SONNET_4 = "claude-sonnet-4-20250514"
CLAUDE_OPUS_4 = "claude-opus-4-20250514"
CLAUDE_OPUS_4_1 = "claude-opus-4-1-20250805"
@@ -685,6 +686,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.CLAUDE_3_5_HAIKU,
ModelType.CLAUDE_3_7_SONNET,
ModelType.CLAUDE_SONNET_4_5,
+ ModelType.CLAUDE_OPUS_4_5,
ModelType.CLAUDE_SONNET_4,
ModelType.CLAUDE_OPUS_4,
ModelType.CLAUDE_OPUS_4_1,
@@ -1521,6 +1523,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.CLAUDE_3_5_HAIKU,
ModelType.CLAUDE_3_7_SONNET,
ModelType.CLAUDE_SONNET_4_5,
+ ModelType.CLAUDE_OPUS_4_5,
ModelType.CLAUDE_SONNET_4,
ModelType.CLAUDE_OPUS_4,
ModelType.CLAUDE_OPUS_4_1,
diff --git a/examples/models/claude_4_5_sonnet_example.py b/examples/models/claude_model_example.py
similarity index 59%
rename from examples/models/claude_4_5_sonnet_example.py
rename to examples/models/claude_model_example.py
index c0d009341..2b6ec9d25 100644
--- a/examples/models/claude_4_5_sonnet_example.py
+++ b/examples/models/claude_model_example.py
@@ -12,19 +12,95 @@
# limitations under the License.
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+import os
+
from camel.agents import ChatAgent
from camel.configs import AnthropicConfig
from camel.models import ModelFactory
-from camel.toolkits import FunctionTool
+from camel.toolkits import FunctionTool, TerminalToolkit
from camel.types import ModelPlatformType, ModelType
"""
-Claude Sonnet 4.5 Example
+Claude Model Example
Please set the environment variable:
export ANTHROPIC_API_KEY="your-api-key-here"
"""
+# Define system message
+sys_msg = "You are a helpful AI assistant"
+
+# Get current script directory
+base_dir = os.path.dirname(os.path.abspath(__file__))
+# Define workspace directory for the toolkit
+workspace_dir = os.path.join(
+ os.path.dirname(os.path.dirname(base_dir)), "workspace"
+)
+
+# Set model config
+tools = [
+ *TerminalToolkit(working_directory=workspace_dir).get_tools(),
+]
+# Create Claude Opus 4.5 model
+model_opus_4_5 = ModelFactory.create(
+ model_platform=ModelPlatformType.ANTHROPIC,
+ model_type=ModelType.CLAUDE_OPUS_4_5,
+ model_config_dict=AnthropicConfig(temperature=0.2).as_dict(),
+)
+
+user_msg = """
+Create an interactive HTML webpage that allows users to play with a
+Rubik's Cube, and saved it to local file.
+"""
+
+camel_agent_pro = ChatAgent(
+ system_message=sys_msg, model=model_opus_4_5, tools=tools
+)
+response_pro = camel_agent_pro.step(user_msg)
+print(response_pro.msgs[0].content)
+'''
+===============================================================================
+The interactive Rubik's Cube HTML file has been created successfully! Here's
+what I built:
+
+## 📁 File: `rubiks_cube.html` (23KB)
+
+### Features:
+
+🎮 **Interactive 3D Cube**
+- Fully rendered 3D Rubik's Cube using CSS transforms
+- Drag to rotate the view (mouse or touch)
+- All 6 faces visible with proper colors
+
+🔄 **Face Rotations**
+- **F/B** - Front/Back face
+- **U/D** - Up/Down face
+- **L/R** - Left/Right face
+- **'** versions for counter-clockwise rotations
+
+⚡ **Actions**
+- **Scramble** - Randomly mix the cube with 20 moves
+- **Reset** - Return to solved state
+- **Undo** - Reverse the last move
+
+📐 **Net View**
+- 2D unfolded view of all cube faces for easier tracking
+
+⌨️ **Keyboard Support**
+- Press F, B, R, L, U, D keys to rotate faces
+- Hold Shift for counter-clockwise
+
+📱 **Responsive Design**
+- Works on desktop and mobile devices
+- Touch support for rotating the view
+
+### To use:
+Simply open `rubiks_cube.html` in any modern web browser!
+
+Process finished with exit code 0
+===============================================================================
+'''
+
# Create Claude Sonnet 4.5 model
model = ModelFactory.create(
model_platform=ModelPlatformType.ANTHROPIC,
@@ -32,9 +108,6 @@ model = ModelFactory.create(
model_config_dict=AnthropicConfig(temperature=0.2).as_dict(),
)
-# Define system message
-sys_msg = "You are a helpful AI assistant powered by Claude Sonnet 4.5."
-
# Set agent
camel_agent = ChatAgent(system_message=sys_msg, model=model)
diff --git a/test/models/test_anthropic_model.py b/test/models/test_anthropic_model.py
index a5431cfd6..4f5f43c35 100644
--- a/test/models/test_anthropic_model.py
+++ b/test/models/test_anthropic_model.py
@@ -34,6 +34,7 @@ from camel.utils import OpenAITokenCounter
ModelType.CLAUDE_3_5_HAIKU,
ModelType.CLAUDE_3_7_SONNET,
ModelType.CLAUDE_SONNET_4_5,
+ ModelType.CLAUDE_OPUS_4_5,
ModelType.CLAUDE_SONNET_4,
ModelType.CLAUDE_OPUS_4,
ModelType.CLAUDE_OPUS_4_1,