🐫 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: Add support for O3-pro model (#2603)
Sarthak Bhardwajea5ecf253bae
diff --git a/camel/models/openai_model.py b/camel/models/openai_model.pyindex 74a52be05..a93b402e1 100644--- a/camel/models/openai_model.py+++ b/camel/models/openai_model.py@@ -142,6 +142,7 @@ class OpenAIModel(BaseModelBackend):ModelType.O3_MINI,ModelType.O3,ModelType.O4_MINI,+ ModelType.O3_PRO,]:warnings.warn("Warning: You are using an reasoning model (O series), "diff --git a/camel/types/enums.py b/camel/types/enums.pyindex c2496a65c..0ea9f04f7 100644--- a/camel/types/enums.py+++ b/camel/types/enums.py@@ -47,6 +47,7 @@ class ModelType(UnifiedModelType, Enum):GPT_4_1_NANO = "gpt-4.1-nano-2025-04-14"O4_MINI = "o4-mini"O3 = "o3"+ O3_PRO = "o3-pro"AWS_CLAUDE_3_7_SONNET = "anthropic.claude-3-7-sonnet-20250219-v1:0"AWS_CLAUDE_3_5_SONNET = "anthropic.claude-3-5-sonnet-20241022-v2:0"@@ -472,6 +473,7 @@ class ModelType(UnifiedModelType, Enum):ModelType.O1,ModelType.O1_PREVIEW,ModelType.O1_MINI,+ ModelType.O3_PRO,ModelType.O3_MINI,ModelType.GPT_4_5_PREVIEW,ModelType.GPT_4_1,@@ -512,6 +514,7 @@ class ModelType(UnifiedModelType, Enum):ModelType.O1_PREVIEW,ModelType.O1_MINI,ModelType.O3_MINI,+ ModelType.O3_PRO,ModelType.GPT_4_5_PREVIEW,ModelType.GPT_4_1,ModelType.GPT_4_1_MINI,@@ -1207,6 +1210,7 @@ class ModelType(UnifiedModelType, Enum):elif self in {ModelType.O1,ModelType.O3_MINI,+ ModelType.O3_PRO,ModelType.CLAUDE_2_1,ModelType.CLAUDE_3_OPUS,ModelType.CLAUDE_3_SONNET,diff --git a/docs/key_modules/models.md b/docs/key_modules/models.mdindex b3e472161..12c1054b6 100644--- a/docs/key_modules/models.md+++ b/docs/key_modules/models.md@@ -10,7 +10,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/| Model Platform | Model Type(s) ||---------------|--------------|-| **OpenAI** | gpt-4.5-preview, gpt-4o, gpt-4o-mini, o1, o1-preview, o1-mini, o3-mini, gpt-4-turbo, gpt-4, gpt-3.5-turbo |+| **OpenAI** | gpt-4.5-preview, gpt-4o, gpt-4o-mini, o1, o1-preview, o1-mini, o3-mini, o3-pro, gpt-4-turbo, gpt-4, gpt-3.5-turbo || **Azure OpenAI** | gpt-4o, gpt-4-turbo, gpt-4, gpt-3.5-turbo || **Mistral AI** | mistral-large-latest, pixtral-12b-2409, ministral-8b-latest, ministral-3b-latest, open-mistral-nemo, codestral-latest, open-mistral-7b, open-mixtral-8x7b, open-mixtral-8x22b, open-codestral-mamba, magistral-medium-2506 || **Moonshot** | moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |diff --git a/examples/models/openai_o3_pro_example.py b/examples/models/openai_o3_pro_example.pynew file mode 100644index 000000000..dbc073ea3--- /dev/null+++ b/examples/models/openai_o3_pro_example.py@@ -0,0 +1,64 @@+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========++from camel.agents import ChatAgent+from camel.configs import ChatGPTConfig+from camel.models import ModelFactory+from camel.types import ModelPlatformType, ModelType++# Instantiate the O3_PRO reasoning model+o3_pro_model = ModelFactory.create(+ model_platform=ModelPlatformType.OPENAI,+ model_type=ModelType.O3_PRO,+ model_config_dict=ChatGPTConfig().as_dict(),+)++# Set up the chat agent with the O3_PRO model+camel_agent = ChatAgent(model=o3_pro_model)++# Example user message (multi-step reasoning/logic problem)+user_msg = (+ "A farmer has a 3-liter jug and a 5-liter jug. Neither jug has any "+ "measurement marks on it. How can the farmer measure exactly 4 liters of "+ "water using just these two jugs and unlimited water supply? "+ "Explain the steps."+)++# Get response from the agent+response = camel_agent.step(user_msg)+print(response.msgs[0].content)++'''+===============================================================================+Sample Output (O3_PRO Reasoning Model):++To measure exactly 4 liters with a 3-liter and a 5-liter jug:++1. Fill the 5-liter jug completely (5 liters).+2. Pour from the 5-liter jug into the 3-liter jug until the 3-liter jug is+ full.+ - Now, 5-liter jug has 2 liters left; 3-liter jug has 3 liters.+3. Empty the 3-liter jug.+ - Now, 5-liter jug has 2 liters; 3-liter jug is empty.+4. Pour the remaining 2 liters from the 5-liter jug into the 3-liter jug.+ - Now, 5-liter jug is empty; 3-liter jug has 2 liters.+5. Fill the 5-liter jug again (5 liters).+6. Pour from the 5-liter jug into the 3-liter jug until the 3-liter jug is+ full.+ - The 3-liter jug already has 2 liters, so you can add only 1 more liter.+ - Now, 5-liter jug has 4 liters left; 3-liter jug is full (3 liters).++**Result:** The 5-liter jug now contains exactly 4 liters of water.+===============================================================================+'''diff --git a/test/models/test_openai_model.py b/test/models/test_openai_model.pyindex e077e1389..6bfe0307d 100644--- a/test/models/test_openai_model.py+++ b/test/models/test_openai_model.py@@ -35,6 +35,7 @@ from camel.utils import OpenAITokenCounterModelType.O1_MINI,ModelType.GPT_4_5_PREVIEW,ModelType.O3,+ ModelType.O3_PRO,ModelType.O3_MINI,ModelType.O4_MINI,ModelType.GPT_4_1,