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(models): Add Magistral Small 1.2 & Magistral Medium 1.2 models (#3164)

Sarthak Bhardwaj4c6c8ae353a7
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 5ba2858b9..50ed4612f 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -226,6 +226,8 @@ class ModelType(UnifiedModelType, Enum):
MISTRAL_PIXTRAL_12B = "pixtral-12b-2409"
MISTRAL_MEDIUM_3_1 = "mistral-medium-2508"
MISTRAL_SMALL_3_2 = "mistral-small-2506"
+ MAGISTRAL_SMALL_1_2 = "magistral-small-1.2"
+ MAGISTRAL_MEDIUM_1_2 = "magistral-medium-1.2"
# Reka models
REKA_CORE = "reka-core"
@@ -696,6 +698,8 @@ class ModelType(UnifiedModelType, Enum):
ModelType.MISTRAL_3B,
ModelType.MISTRAL_MEDIUM_3_1,
ModelType.MISTRAL_SMALL_3_2,
+ ModelType.MAGISTRAL_SMALL_1_2,
+ ModelType.MAGISTRAL_MEDIUM_1_2,
}
@property
@@ -1223,6 +1227,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.MISTRAL_8B,
ModelType.MISTRAL_3B,
ModelType.MISTRAL_SMALL_3_2,
+ ModelType.MAGISTRAL_SMALL_1_2,
ModelType.QWEN_2_5_CODER_32B,
ModelType.QWEN_2_5_VL_72B,
ModelType.QWEN_2_5_72B,
@@ -1257,6 +1262,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.NETMIND_DEEPSEEK_V3,
ModelType.NOVITA_DEEPSEEK_V3_0324,
ModelType.MISTRAL_MEDIUM_3_1,
+ ModelType.MAGISTRAL_MEDIUM_1_2,
ModelType.ERNIE_4_5_TURBO_128K,
ModelType.DEEPSEEK_V3,
ModelType.MOONSHOT_KIMI_K2,
diff --git a/docs/mintlify/key_modules/models.mdx b/docs/mintlify/key_modules/models.mdx
index 8fdc6645a..606e8f1bf 100644
--- a/docs/mintlify/key_modules/models.mdx
+++ b/docs/mintlify/key_modules/models.mdx
@@ -38,7 +38,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
| :-------------- | :------------ |
| **OpenAI** | gpt-4.5-preview<br/>gpt-4o, gpt-4o-mini<br/>o1, o1-preview, o1-mini<br/>o3-mini, o3-pro<br/>gpt-4-turbo, gpt-4, gpt-3.5-turbo |
| **Azure OpenAI** | gpt-4o, gpt-4-turbo<br/>gpt-4, gpt-3.5-turbo |
-| **Mistral AI** | mistral-large-latest, pixtral-12b-2409<br/>ministral-8b-latest, ministral-3b-latest<br/>open-mistral-nemo, codestral-latest<br/>open-mistral-7b, open-mixtral-8x7b<br/>open-mixtral-8x22b, open-codestral-mamba<br/>mistral-small-2506, mistral-medium-2508 |
+| **Mistral AI** | mistral-large-latest, pixtral-12b-2409<br/>ministral-8b-latest, ministral-3b-latest<br/>open-mistral-nemo, codestral-latest<br/>open-mistral-7b, open-mixtral-8x7b<br/>open-mixtral-8x22b, open-codestral-mamba<br/>mistral-small-2506, mistral-medium-2508<br/>magistral-small-1.2, magistral-medium-1.2 |
| **Moonshot** | moonshot-v1-8k<br/>moonshot-v1-32k<br/>moonshot-v1-128k |
| **Anthropic** | claude-2.1, claude-2.0, claude-instant-1.2<br/>claude-3-opus-latest, claude-3-sonnet-20240229, claude-3-haiku-20240307<br/>claude-3-5-sonnet-latest, claude-3-5-haiku-latest |
| **Gemini** | gemini-2.5-pro, gemini-2.5-flash<br/>gemini-2.0-flash, gemini-2.0-flash-thinking<br/> gemini-2.0-flash-lite|
@@ -153,7 +153,7 @@ Integrate your favorite models into CAMEL-AI with straightforward Python calls.
model = ModelFactory.create(
model_platform=ModelPlatformType.MISTRAL,
- model_type=ModelType.MISTRAL_MEDIUM_3_1,
+ model_type=ModelType.MAGISTRAL_MEDIUM_1_2,
model_config_dict=MistralConfig(temperature=0.0).as_dict(),
)
diff --git a/examples/models/mistral_model_example.py b/examples/models/mistral_model_example.py
index d869c8680..4f7072be8 100644
--- a/examples/models/mistral_model_example.py
+++ b/examples/models/mistral_model_example.py
@@ -141,7 +141,59 @@ sys_msg = "You are a helpful assistant."
# Set agent
camel_agent = ChatAgent(system_message=sys_msg, model=model)
-user_msg = """Say hi to CAMEL AI, one open-source community dedicated to the
+user_msg = """Say hi to CAMEL AI, one open-source community dedicated to the
+ study of autonomous and communicative agents."""
+
+# Get response information
+response = camel_agent.step(user_msg)
+print(response.msgs[0].content)
+"""
+===============================================================================
+Hello to CAMEL AI, an open-source community focused on the research of
+autonomous and communicative agents!
+===============================================================================
+"""
+
+# Example with Magistral Small 1.2
+model = ModelFactory.create(
+ model_platform=ModelPlatformType.MISTRAL,
+ model_type=ModelType.MAGISTRAL_SMALL_1_2,
+ model_config_dict=MistralConfig(temperature=0.0).as_dict(),
+)
+
+# Define system message
+sys_msg = "You are a helpful assistant."
+
+# Set agent
+camel_agent = ChatAgent(system_message=sys_msg, model=model)
+
+user_msg = """Say hi to CAMEL AI, one open-source community dedicated to the
+ study of autonomous and communicative agents."""
+
+# Get response information
+response = camel_agent.step(user_msg)
+print(response.msgs[0].content)
+"""
+===============================================================================
+Hello to CAMEL AI, an open-source community focused on the research of
+autonomous and communicative agents!
+===============================================================================
+"""
+
+# Example with Magistral Medium 1.2
+model = ModelFactory.create(
+ model_platform=ModelPlatformType.MISTRAL,
+ model_type=ModelType.MAGISTRAL_MEDIUM_1_2,
+ model_config_dict=MistralConfig(temperature=0.0).as_dict(),
+)
+
+# Define system message
+sys_msg = "You are a helpful assistant."
+
+# Set agent
+camel_agent = ChatAgent(system_message=sys_msg, model=model)
+
+user_msg = """Say hi to CAMEL AI, one open-source community dedicated to the
study of autonomous and communicative agents."""
# Get response information
@@ -149,7 +201,7 @@ response = camel_agent.step(user_msg)
print(response.msgs[0].content)
"""
===============================================================================
-Hello to CAMEL AI, an open-source community focused on the research of
+Hello to CAMEL AI, an open-source community focused on the research of
autonomous and communicative agents!
===============================================================================
"""
diff --git a/test/models/test_mistral_model.py b/test/models/test_mistral_model.py
index 40dd02fb4..e3ea8a47d 100644
--- a/test/models/test_mistral_model.py
+++ b/test/models/test_mistral_model.py
@@ -34,6 +34,8 @@ from camel.utils import OpenAITokenCounter
ModelType.MISTRAL_PIXTRAL_12B,
ModelType.MISTRAL_MEDIUM_3_1,
ModelType.MISTRAL_SMALL_3_2,
+ ModelType.MAGISTRAL_SMALL_1_2,
+ ModelType.MAGISTRAL_MEDIUM_1_2,
],
)
def test_mistral_model(model_type):