Skip to content

Commit

Permalink
feat: Support OpenAI o3 mini (#1533)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wendong-Fan authored Jan 31, 2025
1 parent 1785f6f commit ce8936f
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ body:
attributes:
label: What version of camel are you using?
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
placeholder: E.g., 0.2.18
placeholder: E.g., 0.2.19
validations:
required: true

Expand Down
2 changes: 1 addition & 1 deletion camel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from camel.logger import disable_logging, enable_logging, set_log_level

__version__ = '0.2.18'
__version__ = '0.2.19'

__all__ = [
'__version__',
Expand Down
1 change: 1 addition & 0 deletions camel/models/openai_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def run(
ModelType.O1,
ModelType.O1_MINI,
ModelType.O1_PREVIEW,
ModelType.O3_MINI,
]:
warnings.warn(
"Warning: You are using an O1 model (O1_MINI or O1_PREVIEW), "
Expand Down
3 changes: 3 additions & 0 deletions camel/types/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ModelType(UnifiedModelType, Enum):
O1 = "o1"
O1_PREVIEW = "o1-preview"
O1_MINI = "o1-mini"
O3_MINI = "o3-mini"

GLM_4 = "glm-4"
GLM_4V = 'glm-4v'
Expand Down Expand Up @@ -215,6 +216,7 @@ def is_openai(self) -> bool:
ModelType.O1,
ModelType.O1_PREVIEW,
ModelType.O1_MINI,
ModelType.O3_MINI,
}

@property
Expand Down Expand Up @@ -562,6 +564,7 @@ def token_limit(self) -> int:
return 131_072
elif self in {
ModelType.O1,
ModelType.O3_MINI,
ModelType.CLAUDE_2_1,
ModelType.CLAUDE_3_OPUS,
ModelType.CLAUDE_3_SONNET,
Expand Down
2 changes: 1 addition & 1 deletion camel/utils/token_counting.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(self, model: UnifiedModelType):
elif ("gpt-3.5-turbo" in self.model) or ("gpt-4" in self.model):
self.tokens_per_message = 3
self.tokens_per_name = 1
elif "o1" in self.model:
elif ("o1" in self.model) or ("o3" in self.model):
self.tokens_per_message = 2
self.tokens_per_name = 1
else:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
project = 'CAMEL'
copyright = '2024, CAMEL-AI.org'
author = 'CAMEL-AI.org'
release = '0.2.18'
release = '0.2.19'

html_favicon = (
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'
Expand Down
2 changes: 1 addition & 1 deletion docs/get_started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ conda create --name camel python=3.10
conda activate camel
# Clone github repo
git clone -b v0.2.18 https://github.com/camel-ai/camel.git
git clone -b v0.2.19 https://github.com/camel-ai/camel.git
# Change directory into project directory
cd camel
Expand Down
4 changes: 2 additions & 2 deletions docs/key_modules/loaders.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,14 @@ response = jina_reader.read_content("https://docs.camel-ai.org/")
print(response)
```
```markdown
>>>Welcome to CAMEL’s documentation! — CAMEL 0.2.18 documentation
>>>Welcome to CAMEL’s documentation! — CAMEL 0.2.19 documentation
===============

[Skip to main content](https://docs.camel-ai.org/#main-content)

Back to top Ctrl+K

[![Image 1](https://raw.githubusercontent.com/camel-ai/camel/master/misc/logo_light.png) ![Image 2](https://raw.githubusercontent.com/camel-ai/camel/master/misc/logo_light.png)CAMEL 0.2.18](https://docs.camel-ai.org/#)
[![Image 1](https://raw.githubusercontent.com/camel-ai/camel/master/misc/logo_light.png) ![Image 2](https://raw.githubusercontent.com/camel-ai/camel/master/misc/logo_light.png)CAMEL 0.2.19](https://docs.camel-ai.org/#)

Search Ctrl+K

Expand Down
2 changes: 1 addition & 1 deletion examples/models/openai_o1_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
o1_model = ModelFactory.create(
model_platform=ModelPlatformType.OPENAI,
model_type=ModelType.O1_MINI, # Or ModelType.O1
model_config_dict=ChatGPTConfig(temperature=0.0).as_dict(),
model_config_dict=ChatGPTConfig().as_dict(),
)

# Set agent
Expand Down
92 changes: 92 additions & 0 deletions examples/models/openai_o3_mini_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# ========= 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.toolkits import SearchToolkit
from camel.types import ModelPlatformType, ModelType

o3_model = ModelFactory.create(
model_platform=ModelPlatformType.OPENAI,
model_type=ModelType.O3_MINI,
model_config_dict=ChatGPTConfig().as_dict(),
)


# Set agent
camel_agent = ChatAgent(
model=o3_model, tools=[SearchToolkit().search_duckduckgo]
)

# Set user message
user_msg = """Search what is deepseek r1, and do a comparison between deepseek
r1 and openai o3 mini and let me know the advantages and disadvantages of
openai o3 mini"""

# Get response information
response = camel_agent.step(user_msg)
print(str(response.info['tool_calls'])[:1000])
'''
===============================================================================
[FunctionCallingRecord(func_name='search_duckduckgo', args={'query': 'what is
deepseek r1, and do a comparison between deepseek r1 and openai o3 mini',
'source': 'text', 'max_results': 5}, result=[{'result_id': 1, 'title':
'DeepSeek R1 vs OpenAI o1: Which One is Better? - Analytics Vidhya',
'description': "The DeepSeek R1 has arrived, and it's not just another AI
model—it's a significant leap in AI capabilities, trained upon the previously
released DeepSeek-V3-Base variant.With the full-fledged release of DeepSeek
R1, it now stands on par with OpenAI o1 in both performance and flexibility.
What makes it even more compelling is its open weight and MIT licensing,
making it commercially ...", 'url': 'https://www.analyticsvidhya.com/blog/2025/
01/deepseek-r1-vs-openai-o1/'}, {'result_id': 2, 'title': 'DeepSeek-R1:
Features, Use Cases, and Comparison with OpenAI', 'description': 'Where
DeepSeek Shines: Mathematical reasoning and code generation, thanks to
RL-driven CoT.; Where OpenAI Has an...
===============================================================================
'''
print(response.msgs[0].content)
# ruff: noqa: RUF001, E501
'''
===============================================================================
Below is an overview of DeepSeek R1, followed by a comparative analysis with OpenAI’s o3-mini model.
• What is DeepSeek R1?
DeepSeek R1 is an AI model that represents a significant leap in reasoning and language capabilities. It stems from prior iterations like DeepSeek-V3-Base but incorporates additional supervised fine-tuning, enabling improvements in mathematical reasoning, logic, and code generation. One of its major selling points is its open nature—released with an open license (MIT) and open weights—making it highly attractive for research, customization, and commercial applications without the traditional licensing barriers. It has been praised for its affordability (with API usage that can be many times cheaper than some competing models) and has been shown on several benchmarks to hold its own against established models.
• What is OpenAI’s o3-mini?
OpenAI’s o3-mini is part of OpenAI’s reasoning model series and is designed to deliver robust performance specifically in STEM areas such as science, mathematics, and coding. Announced as a response to emerging competition (including DeepSeek R1), o3-mini emphasizes cost efficiency while providing competitive reasoning capabilities. It’s integrated into the ChatGPT ecosystem (with availability on ChatGPT’s enterprise and education platforms) and positions itself as a compact yet powerful option that delivers high-quality reasoning at a lower cost than some earlier OpenAI versions.
• Comparing DeepSeek R1 and OpenAI o3-mini:
1. Performance & Capabilities
– Both models are geared toward advanced reasoning tasks, including problem-solving in STEM subjects and code generation.
– DeepSeek R1 has been lauded for its performance enhancements over previous iterations (especially in areas like mathematical reasoning) thanks to intensive fine-tuning, while independent evaluations have pitted it against other high-end models.
– OpenAI o3-mini is tuned to deliver high-quality reasoning with a focus on speed and cost-effectiveness, often showing particularly strong results in STEM benchmarks.
2. Accessibility and Licensing
– DeepSeek R1 is open source with an MIT license. Its openly available weights make it especially attractive for academic research, startups, or any developer who prefers customizable and transparent AI tools without prohibitive licensing fees.
– In contrast, OpenAI o3-mini is available via OpenAI’s platforms (such as ChatGPT and its API). Users generally access it through a subscription or pay-as-you-go model, with pricing structured to remain competitive against both previous OpenAI models and the emerging open-source alternatives.
3. Cost Efficiency
– DeepSeek R1’s open-source nature generally translates into lower entry costs, making it an economical choice for developers and companies that want to deploy advanced reasoning tools without high API fees.
– OpenAI o3-mini, although designed to be more cost-efficient compared to earlier OpenAI releases, is still part of a managed service infrastructure. According to industry reports, it is significantly cheaper (with some mentions of being up to 63% less expensive than some predecessors) and positioned as a competitive alternative in pricing, but it may still come with usage limits tied to subscription tiers.
4. Ecosystem Integration
– With DeepSeek R1, users have the freedom to run the model in customized environments or integrate it within open-source projects—this flexibility can drive innovation in experimental research or bespoke applications.
– OpenAI o3-mini benefits from OpenAI’s established ecosystem and integration into widely used platforms like ChatGPT Enterprise and Education. Its seamless integration means users can quickly leverage its capabilities without dealing with additional infrastructure setups.
In summary, while both DeepSeek R1 and OpenAI o3-mini aim to push forward the frontier of reasoning and STEM-focused AI models, they serve slightly different audiences. DeepSeek R1’s open-weight, open-license approach makes it ideal for those prioritizing versatility and low-cost research or customized product development. On the other hand, OpenAI o3-mini leverages OpenAI’s ecosystem to offer a highly optimized, cost-effective model that is integrated directly into widely used interfaces and platforms, providing a more out-of-the-box solution for end users and enterprise clients.
===============================================================================
'''
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "camel-ai"
version = "0.2.18"
version = "0.2.19"
authors = ["CAMEL-AI.org"]
description = "Communicative Agents for AI Society Study"
readme = "README.md"
Expand Down

0 comments on commit ce8936f

Please sign in to comment.