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 Magistral Medium (magistral-medium-2506) model support (#2594)

Sarthak Bhardwaj9611871273e8
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 1d4e139a9..c2496a65c 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -207,6 +207,7 @@ class ModelType(UnifiedModelType, Enum):
MISTRAL_NEMO = "open-mistral-nemo"
MISTRAL_PIXTRAL_12B = "pixtral-12b-2409"
MISTRAL_MEDIUM_3 = "mistral-medium-latest"
+ MAGISTRAL_MEDIUM = "magistral-medium-2506"
# Reka models
REKA_CORE = "reka-core"
@@ -631,6 +632,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.MISTRAL_8B,
ModelType.MISTRAL_3B,
ModelType.MISTRAL_MEDIUM_3,
+ ModelType.MAGISTRAL_MEDIUM,
}
@property
@@ -1265,6 +1267,11 @@ class ModelType(UnifiedModelType, Enum):
ModelType.TOGETHER_LLAMA_4_SCOUT,
}:
return 10_000_000
+ elif self in {
+ ModelType.MAGISTRAL_MEDIUM,
+ }:
+ return 40_000
+
else:
logger.warning(
f"Unknown model type {self}, set maximum token limit "
diff --git a/docs/key_modules/models.md b/docs/key_modules/models.md
index 97a526549..b3e472161 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:/
|---------------|--------------|
| **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 |
+| **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 |
| **Moonshot** | moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k |
| **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 |
| **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 |
diff --git a/examples/models/mistral_model_example.py b/examples/models/mistral_model_example.py
index c8912063f..f9ef50b20 100644
--- a/examples/models/mistral_model_example.py
+++ b/examples/models/mistral_model_example.py
@@ -102,3 +102,29 @@ study of autonomous and communicative agents. I'm excited to learn more about
your work and how I can assist you. How can I help you today?
===============================================================================
"""
+
+model = ModelFactory.create(
+ model_platform=ModelPlatformType.MISTRAL,
+ model_type=ModelType.MAGISTRAL_MEDIUM,
+ 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, CAMEL AI! It's great to see an open-source community dedicated to the
+study of autonomous and communicative agents. I'm excited to learn more about
+your work and how I can assist you. How can I help you today?
+===============================================================================
+"""
diff --git a/test/models/test_mistral_model.py b/test/models/test_mistral_model.py
index fd413ae56..cc4f6a310 100644
--- a/test/models/test_mistral_model.py
+++ b/test/models/test_mistral_model.py
@@ -34,6 +34,7 @@ from camel.utils import OpenAITokenCounter
ModelType.MISTRAL_CODESTRAL_MAMBA,
ModelType.MISTRAL_PIXTRAL_12B,
ModelType.MISTRAL_MEDIUM_3,
+ ModelType.MAGISTRAL_MEDIUM,
],
)
def test_mistral_model(model_type):