Skip to content

Commit 4c6c8ae

Browse files
feat(models): Add Magistral Small 1.2 & Magistral Medium 1.2 models (#3164)
Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com>
1 parent 5ba7c0a commit 4c6c8ae

File tree

4 files changed

+64
-4
lines changed

4 files changed

+64
-4
lines changed

camel/types/enums.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ class ModelType(UnifiedModelType, Enum):
226226
MISTRAL_PIXTRAL_12B = "pixtral-12b-2409"
227227
MISTRAL_MEDIUM_3_1 = "mistral-medium-2508"
228228
MISTRAL_SMALL_3_2 = "mistral-small-2506"
229+
MAGISTRAL_SMALL_1_2 = "magistral-small-1.2"
230+
MAGISTRAL_MEDIUM_1_2 = "magistral-medium-1.2"
229231

230232
# Reka models
231233
REKA_CORE = "reka-core"
@@ -696,6 +698,8 @@ def is_mistral(self) -> bool:
696698
ModelType.MISTRAL_3B,
697699
ModelType.MISTRAL_MEDIUM_3_1,
698700
ModelType.MISTRAL_SMALL_3_2,
701+
ModelType.MAGISTRAL_SMALL_1_2,
702+
ModelType.MAGISTRAL_MEDIUM_1_2,
699703
}
700704

701705
@property
@@ -1223,6 +1227,7 @@ def token_limit(self) -> int:
12231227
ModelType.MISTRAL_8B,
12241228
ModelType.MISTRAL_3B,
12251229
ModelType.MISTRAL_SMALL_3_2,
1230+
ModelType.MAGISTRAL_SMALL_1_2,
12261231
ModelType.QWEN_2_5_CODER_32B,
12271232
ModelType.QWEN_2_5_VL_72B,
12281233
ModelType.QWEN_2_5_72B,
@@ -1257,6 +1262,7 @@ def token_limit(self) -> int:
12571262
ModelType.NETMIND_DEEPSEEK_V3,
12581263
ModelType.NOVITA_DEEPSEEK_V3_0324,
12591264
ModelType.MISTRAL_MEDIUM_3_1,
1265+
ModelType.MAGISTRAL_MEDIUM_1_2,
12601266
ModelType.ERNIE_4_5_TURBO_128K,
12611267
ModelType.DEEPSEEK_V3,
12621268
ModelType.MOONSHOT_KIMI_K2,

docs/mintlify/key_modules/models.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
3838
| :-------------- | :------------ |
3939
| **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 |
4040
| **Azure OpenAI** | gpt-4o, gpt-4-turbo<br/>gpt-4, gpt-3.5-turbo |
41-
| **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 |
41+
| **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 |
4242
| **Moonshot** | moonshot-v1-8k<br/>moonshot-v1-32k<br/>moonshot-v1-128k |
4343
| **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 |
4444
| **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.
153153

154154
model = ModelFactory.create(
155155
model_platform=ModelPlatformType.MISTRAL,
156-
model_type=ModelType.MISTRAL_MEDIUM_3_1,
156+
model_type=ModelType.MAGISTRAL_MEDIUM_1_2,
157157
model_config_dict=MistralConfig(temperature=0.0).as_dict(),
158158
)
159159

examples/models/mistral_model_example.py

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,67 @@
141141
# Set agent
142142
camel_agent = ChatAgent(system_message=sys_msg, model=model)
143143

144-
user_msg = """Say hi to CAMEL AI, one open-source community dedicated to the
144+
user_msg = """Say hi to CAMEL AI, one open-source community dedicated to the
145+
study of autonomous and communicative agents."""
146+
147+
# Get response information
148+
response = camel_agent.step(user_msg)
149+
print(response.msgs[0].content)
150+
"""
151+
===============================================================================
152+
Hello to CAMEL AI, an open-source community focused on the research of
153+
autonomous and communicative agents!
154+
===============================================================================
155+
"""
156+
157+
# Example with Magistral Small 1.2
158+
model = ModelFactory.create(
159+
model_platform=ModelPlatformType.MISTRAL,
160+
model_type=ModelType.MAGISTRAL_SMALL_1_2,
161+
model_config_dict=MistralConfig(temperature=0.0).as_dict(),
162+
)
163+
164+
# Define system message
165+
sys_msg = "You are a helpful assistant."
166+
167+
# Set agent
168+
camel_agent = ChatAgent(system_message=sys_msg, model=model)
169+
170+
user_msg = """Say hi to CAMEL AI, one open-source community dedicated to the
171+
study of autonomous and communicative agents."""
172+
173+
# Get response information
174+
response = camel_agent.step(user_msg)
175+
print(response.msgs[0].content)
176+
"""
177+
===============================================================================
178+
Hello to CAMEL AI, an open-source community focused on the research of
179+
autonomous and communicative agents!
180+
===============================================================================
181+
"""
182+
183+
# Example with Magistral Medium 1.2
184+
model = ModelFactory.create(
185+
model_platform=ModelPlatformType.MISTRAL,
186+
model_type=ModelType.MAGISTRAL_MEDIUM_1_2,
187+
model_config_dict=MistralConfig(temperature=0.0).as_dict(),
188+
)
189+
190+
# Define system message
191+
sys_msg = "You are a helpful assistant."
192+
193+
# Set agent
194+
camel_agent = ChatAgent(system_message=sys_msg, model=model)
195+
196+
user_msg = """Say hi to CAMEL AI, one open-source community dedicated to the
145197
study of autonomous and communicative agents."""
146198

147199
# Get response information
148200
response = camel_agent.step(user_msg)
149201
print(response.msgs[0].content)
150202
"""
151203
===============================================================================
152-
Hello to CAMEL AI, an open-source community focused on the research of
204+
Hello to CAMEL AI, an open-source community focused on the research of
153205
autonomous and communicative agents!
154206
===============================================================================
155207
"""

test/models/test_mistral_model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
ModelType.MISTRAL_PIXTRAL_12B,
3535
ModelType.MISTRAL_MEDIUM_3_1,
3636
ModelType.MISTRAL_SMALL_3_2,
37+
ModelType.MAGISTRAL_SMALL_1_2,
38+
ModelType.MAGISTRAL_MEDIUM_1_2,
3739
],
3840
)
3941
def test_mistral_model(model_type):

0 commit comments

Comments
 (0)