Skip to content

Commit ea5ecf2

Browse files
1sarthakbhardwajfengju0213Wendong-Fan
authored
feat: Add support for O3-pro model (#2603)
Co-authored-by: Tao Sun <168447269+fengju0213@users.noreply.github.com> Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com>
1 parent 6fde324 commit ea5ecf2

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed

camel/models/openai_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def _sanitize_config(self, config_dict: Dict[str, Any]) -> Dict[str, Any]:
142142
ModelType.O3_MINI,
143143
ModelType.O3,
144144
ModelType.O4_MINI,
145+
ModelType.O3_PRO,
145146
]:
146147
warnings.warn(
147148
"Warning: You are using an reasoning model (O series), "

camel/types/enums.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class ModelType(UnifiedModelType, Enum):
4747
GPT_4_1_NANO = "gpt-4.1-nano-2025-04-14"
4848
O4_MINI = "o4-mini"
4949
O3 = "o3"
50+
O3_PRO = "o3-pro"
5051

5152
AWS_CLAUDE_3_7_SONNET = "anthropic.claude-3-7-sonnet-20250219-v1:0"
5253
AWS_CLAUDE_3_5_SONNET = "anthropic.claude-3-5-sonnet-20241022-v2:0"
@@ -472,6 +473,7 @@ def is_openai(self) -> bool:
472473
ModelType.O1,
473474
ModelType.O1_PREVIEW,
474475
ModelType.O1_MINI,
476+
ModelType.O3_PRO,
475477
ModelType.O3_MINI,
476478
ModelType.GPT_4_5_PREVIEW,
477479
ModelType.GPT_4_1,
@@ -512,6 +514,7 @@ def is_azure_openai(self) -> bool:
512514
ModelType.O1_PREVIEW,
513515
ModelType.O1_MINI,
514516
ModelType.O3_MINI,
517+
ModelType.O3_PRO,
515518
ModelType.GPT_4_5_PREVIEW,
516519
ModelType.GPT_4_1,
517520
ModelType.GPT_4_1_MINI,
@@ -1207,6 +1210,7 @@ def token_limit(self) -> int:
12071210
elif self in {
12081211
ModelType.O1,
12091212
ModelType.O3_MINI,
1213+
ModelType.O3_PRO,
12101214
ModelType.CLAUDE_2_1,
12111215
ModelType.CLAUDE_3_OPUS,
12121216
ModelType.CLAUDE_3_SONNET,

docs/key_modules/models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
1010

1111
| Model Platform | Model Type(s) |
1212
|---------------|--------------|
13-
| **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 |
13+
| **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 |
1414
| **Azure OpenAI** | gpt-4o, gpt-4-turbo, gpt-4, gpt-3.5-turbo |
1515
| **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 |
1616
| **Moonshot** | moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14+
15+
from camel.agents import ChatAgent
16+
from camel.configs import ChatGPTConfig
17+
from camel.models import ModelFactory
18+
from camel.types import ModelPlatformType, ModelType
19+
20+
# Instantiate the O3_PRO reasoning model
21+
o3_pro_model = ModelFactory.create(
22+
model_platform=ModelPlatformType.OPENAI,
23+
model_type=ModelType.O3_PRO,
24+
model_config_dict=ChatGPTConfig().as_dict(),
25+
)
26+
27+
# Set up the chat agent with the O3_PRO model
28+
camel_agent = ChatAgent(model=o3_pro_model)
29+
30+
# Example user message (multi-step reasoning/logic problem)
31+
user_msg = (
32+
"A farmer has a 3-liter jug and a 5-liter jug. Neither jug has any "
33+
"measurement marks on it. How can the farmer measure exactly 4 liters of "
34+
"water using just these two jugs and unlimited water supply? "
35+
"Explain the steps."
36+
)
37+
38+
# Get response from the agent
39+
response = camel_agent.step(user_msg)
40+
print(response.msgs[0].content)
41+
42+
'''
43+
===============================================================================
44+
Sample Output (O3_PRO Reasoning Model):
45+
46+
To measure exactly 4 liters with a 3-liter and a 5-liter jug:
47+
48+
1. Fill the 5-liter jug completely (5 liters).
49+
2. Pour from the 5-liter jug into the 3-liter jug until the 3-liter jug is
50+
full.
51+
- Now, 5-liter jug has 2 liters left; 3-liter jug has 3 liters.
52+
3. Empty the 3-liter jug.
53+
- Now, 5-liter jug has 2 liters; 3-liter jug is empty.
54+
4. Pour the remaining 2 liters from the 5-liter jug into the 3-liter jug.
55+
- Now, 5-liter jug is empty; 3-liter jug has 2 liters.
56+
5. Fill the 5-liter jug again (5 liters).
57+
6. Pour from the 5-liter jug into the 3-liter jug until the 3-liter jug is
58+
full.
59+
- The 3-liter jug already has 2 liters, so you can add only 1 more liter.
60+
- Now, 5-liter jug has 4 liters left; 3-liter jug is full (3 liters).
61+
62+
**Result:** The 5-liter jug now contains exactly 4 liters of water.
63+
===============================================================================
64+
'''

test/models/test_openai_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
ModelType.O1_MINI,
3636
ModelType.GPT_4_5_PREVIEW,
3737
ModelType.O3,
38+
ModelType.O3_PRO,
3839
ModelType.O3_MINI,
3940
ModelType.O4_MINI,
4041
ModelType.GPT_4_1,

0 commit comments

Comments
 (0)