Skip to content

Commit 8cbe9cf

Browse files
authored
feat: support gpt 5.2 and clean example code (#3564)
1 parent 450eee7 commit 8cbe9cf

File tree

7 files changed

+34
-474
lines changed

7 files changed

+34
-474
lines changed

camel/types/enums.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class ModelType(UnifiedModelType, Enum):
5050
O3 = "o3"
5151
O3_PRO = "o3-pro"
5252
GPT_5_1 = "gpt-5.1"
53+
GPT_5_2 = ("gpt-5.2",)
5354
GPT_5 = "gpt-5"
5455
GPT_5_MINI = "gpt-5-mini"
5556
GPT_5_NANO = "gpt-5-nano"
@@ -597,6 +598,7 @@ def is_openai(self) -> bool:
597598
ModelType.O4_MINI,
598599
ModelType.O3,
599600
ModelType.GPT_5_1,
601+
ModelType.GPT_5_2,
600602
}
601603

602604
@property
@@ -1542,6 +1544,7 @@ def token_limit(self) -> int:
15421544
return 320_000
15431545
elif self in {
15441546
ModelType.GPT_5_1,
1547+
ModelType.GPT_5_2,
15451548
ModelType.GPT_5_MINI,
15461549
ModelType.GPT_5_NANO,
15471550
ModelType.GPT_5,
Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,52 @@
1515
from camel.agents import ChatAgent
1616
from camel.configs import ChatGPTConfig
1717
from camel.models import ModelFactory
18+
from camel.toolkits import TerminalToolkit
1819
from camel.types import ModelPlatformType, ModelType
1920

21+
tools = [
22+
*TerminalToolkit().get_tools(),
23+
]
24+
2025
gpt_5_model = ModelFactory.create(
2126
model_platform=ModelPlatformType.OPENAI,
22-
model_type=ModelType.GPT_5,
27+
model_type=ModelType.GPT_5_2,
2328
model_config_dict=ChatGPTConfig().as_dict(),
2429
)
2530

2631
# Set agent
27-
camel_agent = ChatAgent(model=gpt_5_model)
32+
camel_agent = ChatAgent(model=gpt_5_model, tools=tools)
2833

2934
# Set user message
30-
user_msg = """Say hi to CAMEL AI, one open-source community
31-
dedicated to the study of autonomous and communicative agents."""
35+
user_msg = """Use tool to create an interactive HTML webpage that allows users
36+
to play with a Rubik's Cube, and saved it to local file.
37+
"""
3238

3339
# Get response information
3440
response = camel_agent.step(user_msg)
3541
print(response.msgs[0].content)
3642
'''
3743
===============================================================================
38-
Hello, CAMEL AI! Great to connect with an open-source community advancing
39-
autonomous and communicative agents. Wishing you continued success—excited to
40-
see what you build next!
44+
Created an interactive Rubik's Cube webpage and saved it locally as:
45+
46+
- `rubiks_cube.html`
47+
48+
It includes:
49+
- 3D cube rendering (drag to orbit, wheel to zoom)
50+
- Face turns via buttons or keyboard (U/D/L/R/F/B, Shift for prime)
51+
- Scramble, reset, random move
52+
- Undo/redo
53+
- Copyable moves log
54+
55+
Open it by double-clicking the file or serving it locally
56+
(recommended due to browser module/security policies):
57+
58+
```bash
59+
python3 -m http.server
60+
# then visit http://localhost:8000/rubiks_cube.html
61+
```
62+
63+
If you want a **fully offline** version (no CDN usage), tell me and
64+
I'll modify it to bundle the required libraries locally or inline them.
4165
===============================================================================
4266
'''

examples/models/openai_gpt_4.1_example.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

examples/models/openai_gpt_4.5_preview_example.py

Lines changed: 0 additions & 94 deletions
This file was deleted.

examples/models/openai_o1_example.py

Lines changed: 0 additions & 173 deletions
This file was deleted.

0 commit comments

Comments
 (0)