Skip to content

Commit a00fb77

Browse files
authored
feat: Support openai o1 models (#936)
1 parent 5037f68 commit a00fb77

File tree

10 files changed

+379
-350
lines changed

10 files changed

+379
-350
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ body:
2727
attributes:
2828
label: What version of camel are you using?
2929
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
30-
placeholder: E.g., 0.1.8
30+
placeholder: E.g., 0.1.9
3131
validations:
3232
required: true
3333

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ conda create --name camel python=3.10
119119
conda activate camel
120120
121121
# Clone github repo
122-
git clone -b v0.1.8 https://github.com/camel-ai/camel.git
122+
git clone -b v0.1.9 https://github.com/camel-ai/camel.git
123123
124124
# Change directory into project directory
125125
cd camel

camel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# limitations under the License.
1313
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
1414

15-
__version__ = '0.1.8'
15+
__version__ = '0.1.9'
1616

1717
__all__ = [
1818
'__version__',

camel/types/enums.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class ModelType(Enum):
2929
GPT_4_TURBO = "gpt-4-turbo"
3030
GPT_4O = "gpt-4o"
3131
GPT_4O_MINI = "gpt-4o-mini"
32+
O1_PREVIEW = "o1-preview"
33+
O1_MINI = "o1-mini"
3234

3335
GLM_4 = "glm-4"
3436
GLM_4_OPEN_SOURCE = "glm-4-open-source"
@@ -105,6 +107,8 @@ def is_openai(self) -> bool:
105107
ModelType.GPT_4_TURBO,
106108
ModelType.GPT_4O,
107109
ModelType.GPT_4O_MINI,
110+
ModelType.O1_PREVIEW,
111+
ModelType.O1_MINI,
108112
}
109113

110114
@property
@@ -270,6 +274,8 @@ def token_limit(self) -> int:
270274
ModelType.GPT_4O,
271275
ModelType.GPT_4O_MINI,
272276
ModelType.GPT_4_TURBO,
277+
ModelType.O1_PREVIEW,
278+
ModelType.O1_MINI,
273279
ModelType.MISTRAL_LARGE,
274280
ModelType.MISTRAL_NEMO,
275281
ModelType.QWEN_2,

camel/utils/token_counting.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ def __init__(self, model: ModelType):
288288
elif ("gpt-3.5-turbo" in self.model) or ("gpt-4" in self.model):
289289
self.tokens_per_message = 3
290290
self.tokens_per_name = 1
291+
elif "o1" in self.model:
292+
self.tokens_per_message = 2
293+
self.tokens_per_name = 1
291294
else:
292295
# flake8: noqa :E501
293296
raise NotImplementedError(

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
project = 'CAMEL'
2828
copyright = '2023, CAMEL-AI.org'
2929
author = 'CAMEL-AI.org'
30-
release = '0.1.8'
30+
release = '0.1.9'
3131

3232
html_favicon = (
3333
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'

docs/get_started/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ conda create --name camel python=3.10
6161
conda activate camel
6262
6363
# Clone github repo
64-
git clone -b v0.1.8 https://github.com/camel-ai/camel.git
64+
git clone -b v0.1.9 https://github.com/camel-ai/camel.git
6565
6666
# Change directory into project directory
6767
cd camel

poetry.lock

Lines changed: 361 additions & 343 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "camel-ai"
7-
version = "0.1.8"
7+
version = "0.1.9"
88
authors = ["CAMEL-AI.org"]
99
description = "Communicative Agents for AI Society Study"
1010
readme = "README.md"
@@ -29,7 +29,7 @@ documentation = "https://docs.camel-ai.org"
2929
[tool.poetry.dependencies]
3030
python = ">=3.10.0,<3.12"
3131
numpy = "^1"
32-
openai = "^1.2.3"
32+
openai = "^1.45.0"
3333
groq = "^0.5.0"
3434
anthropic = "^0.29.0"
3535
tiktoken = "^0.7.0"

test/models/test_openai_model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
ModelType.GPT_4_TURBO,
3131
ModelType.GPT_4O,
3232
ModelType.GPT_4O_MINI,
33+
ModelType.O1_PREVIEW,
34+
ModelType.O1_MINI,
3335
],
3436
)
3537
def test_openai_model(model_type):

0 commit comments

Comments
 (0)