Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

feat:add gpt4.5 model (#1673)

Yifeng Wang(正经人王同学)20b17cca31a8
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 29cb6ff7e..2754cd23d 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -34,6 +34,7 @@ class ModelType(UnifiedModelType, Enum):
GPT_4_TURBO = "gpt-4-turbo"
GPT_4O = "gpt-4o"
GPT_4O_MINI = "gpt-4o-mini"
+ GPT_4_5_PREVIEW = "gpt-4.5-preview"
O1 = "o1"
O1_PREVIEW = "o1-preview"
O1_MINI = "o1-mini"
@@ -263,6 +264,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.O1_PREVIEW,
ModelType.O1_MINI,
ModelType.O3_MINI,
+ ModelType.GPT_4_5_PREVIEW,
}
@property
@@ -623,6 +625,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.GPT_4_TURBO,
ModelType.O1_PREVIEW,
ModelType.O1_MINI,
+ ModelType.GPT_4_5_PREVIEW,
ModelType.MISTRAL_LARGE,
ModelType.MISTRAL_NEMO,
ModelType.MISTRAL_PIXTRAL_12B,
diff --git a/docs/key_modules/models.md b/docs/key_modules/models.md
index 859feabc8..e2497b399 100644
--- a/docs/key_modules/models.md
+++ b/docs/key_modules/models.md
@@ -12,7 +12,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
| Model Platform | Model Type(s) |
|---------------|--------------|
-| **OpenAI** | 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, 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 |
| **Moonshot** | moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |
diff --git a/examples/models/openai_gpt_4.5_preview_example.py b/examples/models/openai_gpt_4.5_preview_example.py
new file mode 100644
index 000000000..94816f833
--- /dev/null
+++ b/examples/models/openai_gpt_4.5_preview_example.py
@@ -0,0 +1,94 @@
+# ========= 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
+
+gpt_4_5_preview_model = ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4_5_PREVIEW,
+ model_config_dict=ChatGPTConfig().as_dict(),
+)
+
+# Set agent
+camel_agent = ChatAgent(model=gpt_4_5_preview_model)
+
+# Set user message
+user_msg = """Please write inspirational poems
+that make people feel hopeful and enthusiastic about life"""
+
+# Get response information
+response = camel_agent.step(user_msg)
+print(response.msgs[0].content)
+'''
+===============================================================================
+
+### Poem 1: Embrace the Dawn
+
+Awaken now, the dawn is near,
+A fresh new day, release your fear.
+Yesterday's shadows fade away,
+Hope blooms bright, embrace today.
+
+Rise with courage, dreams in sight,
+Your heart ablaze, your spirit bright.
+Each step forward, strength you find,
+A brighter future, yours to bind.
+
+Believe in you, your path is clear,
+Trust your journey, hold it dear.
+Life's beauty shines, a guiding star,
+You're stronger now than ever you are.
+
+---
+
+### Poem 2: The Power Within
+
+Within your heart, a spark resides,
+A strength that never truly hides.
+Through storms and trials, you will rise,
+With hope and courage in your eyes.
+
+Your dreams are seeds, plant them deep,
+Nurture faith, your promise keep.
+Life's journey vast, adventure grand,
+Hold tight to hope, take life's hand.
+
+Enthusiasm fuels your way,
+Brightens every single day.
+Believe, persist, your spirit free,
+The power within—your destiny.
+
+---
+
+### Poem 3: A New Beginning
+
+Each sunrise brings a fresh new start,
+A chance to heal, renew your heart.
+Let go of doubts, embrace the light,
+Your future shines, forever bright.
+
+Life's canvas blank, your colors bold,
+Paint your dreams, let joy unfold.
+Hope whispers softly, "You can soar,"
+Open wide life's wondrous door.
+
+Enthusiasm fills your soul,
+Guiding you toward your goal.
+With hope alive, your spirit strong,
+Life's melody—your hopeful song.
+===============================================================================
+'''
diff --git a/test/models/test_openai_model.py b/test/models/test_openai_model.py
index d69cc4dae..11876af37 100644
--- a/test/models/test_openai_model.py
+++ b/test/models/test_openai_model.py
@@ -33,6 +33,7 @@ from camel.utils import OpenAITokenCounter
ModelType.O1,
ModelType.O1_PREVIEW,
ModelType.O1_MINI,
+ ModelType.GPT_4_5_PREVIEW,
],
)
def test_openai_model(model_type: ModelType):