Skip to content

Commit 9611871

Browse files
feat: add Magistral Medium (magistral-medium-2506) model support (#2594)
Co-authored-by: Wendong <w3ndong.fan@gmail.com> Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com>
1 parent ee02f22 commit 9611871

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

camel/types/enums.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ class ModelType(UnifiedModelType, Enum):
207207
MISTRAL_NEMO = "open-mistral-nemo"
208208
MISTRAL_PIXTRAL_12B = "pixtral-12b-2409"
209209
MISTRAL_MEDIUM_3 = "mistral-medium-latest"
210+
MAGISTRAL_MEDIUM = "magistral-medium-2506"
210211

211212
# Reka models
212213
REKA_CORE = "reka-core"
@@ -631,6 +632,7 @@ def is_mistral(self) -> bool:
631632
ModelType.MISTRAL_8B,
632633
ModelType.MISTRAL_3B,
633634
ModelType.MISTRAL_MEDIUM_3,
635+
ModelType.MAGISTRAL_MEDIUM,
634636
}
635637

636638
@property
@@ -1265,6 +1267,11 @@ def token_limit(self) -> int:
12651267
ModelType.TOGETHER_LLAMA_4_SCOUT,
12661268
}:
12671269
return 10_000_000
1270+
elif self in {
1271+
ModelType.MAGISTRAL_MEDIUM,
1272+
}:
1273+
return 40_000
1274+
12681275
else:
12691276
logger.warning(
12701277
f"Unknown model type {self}, set maximum token limit "

docs/key_modules/models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
1212
|---------------|--------------|
1313
| **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 |
1414
| **Azure OpenAI** | gpt-4o, gpt-4-turbo, gpt-4, gpt-3.5-turbo |
15-
| **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 |
15+
| **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, magistral-medium-2506 |
1616
| **Moonshot** | moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |
1717
| **Anthropic** | claude-2.1, claude-2.0, claude-instant-1.2, claude-3-opus-latest, claude-3-sonnet-20240229, claude-3-haiku-20240307, claude-3-5-sonnet-latest, claude-3-5-haiku-latest |
1818
| **Gemini** | gemini-2.5-flash-preview-04-17, gemini-2.5-pro-preview-06-05, gemini-2.0-flash, gemini-2.0-flash-exp, gemini-2.0-flash-thinking-exp, gemini-2.0-pro-exp-02-05, gemini-2.0-flash-lite, gemini-2.0-flash-lite-preview-02-05, gemini-1.5-flash, gemini-1.5-pro |

examples/models/mistral_model_example.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,29 @@
102102
your work and how I can assist you. How can I help you today?
103103
===============================================================================
104104
"""
105+
106+
model = ModelFactory.create(
107+
model_platform=ModelPlatformType.MISTRAL,
108+
model_type=ModelType.MAGISTRAL_MEDIUM,
109+
model_config_dict=MistralConfig(temperature=0.0).as_dict(),
110+
)
111+
112+
# Define system message
113+
sys_msg = "You are a helpful assistant."
114+
115+
# Set agent
116+
camel_agent = ChatAgent(system_message=sys_msg, model=model)
117+
118+
user_msg = """Say hi to CAMEL AI, one open-source community dedicated to the
119+
study of autonomous and communicative agents."""
120+
121+
# Get response information
122+
response = camel_agent.step(user_msg)
123+
print(response.msgs[0].content)
124+
"""
125+
===============================================================================
126+
Hello, CAMEL AI! It's great to see an open-source community dedicated to the
127+
study of autonomous and communicative agents. I'm excited to learn more about
128+
your work and how I can assist you. How can I help you today?
129+
===============================================================================
130+
"""

test/models/test_mistral_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
ModelType.MISTRAL_CODESTRAL_MAMBA,
3535
ModelType.MISTRAL_PIXTRAL_12B,
3636
ModelType.MISTRAL_MEDIUM_3,
37+
ModelType.MAGISTRAL_MEDIUM,
3738
],
3839
)
3940
def test_mistral_model(model_type):

0 commit comments

Comments
 (0)