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 GLM-5.1 and GLM-5.2 support (#4115)

Tao Sunaa4d5c0a8fff
diff --git a/camel/configs/zhipuai_config.py b/camel/configs/zhipuai_config.py
index 9dd7a7076..3ef2417fe 100644
--- a/camel/configs/zhipuai_config.py
+++ b/camel/configs/zhipuai_config.py
@@ -61,6 +61,8 @@ class ZhipuAIConfig(BaseConfig):
interleaved thinking mode for GLM-4.5+ models. When enabled, the
model reasons before each response and tool call.
(default: :obj:`None`)
+ reasoning_effort (str, optional): Controls reasoning depth for GLM-5.2.
+ Supported values are provider-defined. (default: :obj:`None`)
"""
temperature: Optional[float] = None
@@ -72,6 +74,7 @@ class ZhipuAIConfig(BaseConfig):
Union[Dict[str, Union[str, Dict[str, str]]], str]
] = None
interleaved_thinking: Optional[bool] = None
+ reasoning_effort: Optional[str] = None
ZHIPUAI_API_PARAMS = {param for param in ZhipuAIConfig.model_fields.keys()}
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 3a2b96cb7..6c1e582c2 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -75,7 +75,9 @@ class ModelType(UnifiedModelType, Enum):
AMD_GPT4 = "dvue-aoai-001-gpt-4.1"
- # ZhipuAI GLM-4.7 series (latest)
+ # ZhipuAI GLM-5 series (latest)
+ GLM_5_2 = "glm-5.2"
+ GLM_5_1 = "glm-5.1"
GLM_5 = "glm-5"
GLM_4_7 = "glm-4.7"
GLM_4_7_FLASHX = "glm-4.7-flashx"
@@ -733,6 +735,8 @@ class ModelType(UnifiedModelType, Enum):
ModelType.GLM_4_FLASH,
ModelType.GLM_4_FLASH_250414,
ModelType.GLM_ZERO_PREVIEW,
+ ModelType.GLM_5_2,
+ ModelType.GLM_5_1,
ModelType.GLM_5,
ModelType.GLM_4_7,
ModelType.GLM_4_7_FLASHX,
@@ -1662,6 +1666,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.AWS_CLAUDE_OPUS_4_1,
ModelType.O4_MINI,
ModelType.O3,
+ ModelType.GLM_5_1,
ModelType.GLM_5,
ModelType.GLM_4_7,
ModelType.GLM_4_7_FLASHX,
@@ -1738,6 +1743,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.GPT_5_4_PRO,
ModelType.GPT_5_5,
ModelType.GPT_5_5_PRO,
+ ModelType.GLM_5_2,
ModelType.MINIMAX_M3,
ModelType.ORCAROUTER_CLAUDE_OPUS_4_7,
ModelType.ORCAROUTER_GROK_4_3,
diff --git a/docs/key_modules/models.md b/docs/key_modules/models.md
index ccc7b9231..47259ebc1 100644
--- a/docs/key_modules/models.md
+++ b/docs/key_modules/models.md
@@ -47,7 +47,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
| **Gemini** | gemini-3.1-pro-preview, gemini-3.1-flash-lite-preview<br/>gemini-3-pro-preview, gemini-3-flash-preview<br/>gemini-2.5-pro, gemini-2.5-flash<br/>gemini-2.0-flash, gemini-2.0-flash-exp<br/>gemini-2.0-flash-thinking-exp, gemini-2.0-pro-exp-02-05<br/>gemini-2.0-flash-lite, gemini-2.0-flash-lite-preview-02-05 |
| **Qwen** | qwen3-coder-plus<br/>qwen-max, qwen-plus, qwen-turbo, qwen-long<br/>qwen-plus-latest, qwen-plus-2025-04-28, qwen-turbo-latest, qwen-turbo-2025-04-28<br/>qwen-vl-max, qwen-vl-plus, qwen2.5-vl-72b-instruct<br/>qwen-math-plus, qwen-math-turbo, qwen-coder-turbo<br/>qwen2.5-coder-32b-instruct, qwen2.5-72b-instruct, qwen2.5-32b-instruct, qwen2.5-14b-instruct<br/>qwq-32b-preview, qwq-plus, qvq-72b-preview |
| **DeepSeek** | deepseek-v4-flash, deepseek-v4-pro<br/>deepseek-chat, deepseek-reasoner |
-| **ZhipuAI** | glm-5, glm-4.7, glm-4.7-flash, glm-4.7-flashx<br/>glm-4.6, glm-4.6v, glm-4.6v-flash, glm-4.6v-flashx<br/>glm-4.5v, glm-4.5-air, glm-4.5-airx, glm-4.5-flash<br/>glm-4, glm-4v, glm-4v-flash<br/>glm-4v-plus-0111, glm-4-plus, glm-4-air<br/>glm-4-air-0111, glm-4-airx, glm-4-long<br/>glm-4-flashx, glm-4-flashx-250414<br/>glm-4-flash, glm-4-flash-250414<br/>glm-4.1v-thinking-flash, glm-4.1v-thinking-flashx<br/>glm-zero-preview, glm-3-turbo |
+| **ZhipuAI** | glm-5.2, glm-5.1, glm-5, glm-4.7, glm-4.7-flash, glm-4.7-flashx<br/>glm-4.6, glm-4.6v, glm-4.6v-flash, glm-4.6v-flashx<br/>glm-4.5v, glm-4.5-air, glm-4.5-airx, glm-4.5-flash<br/>glm-4, glm-4v, glm-4v-flash<br/>glm-4v-plus-0111, glm-4-plus, glm-4-air<br/>glm-4-air-0111, glm-4-airx, glm-4-long<br/>glm-4-flashx, glm-4-flashx-250414<br/>glm-4-flash, glm-4-flash-250414<br/>glm-4.1v-thinking-flash, glm-4.1v-thinking-flashx<br/>glm-zero-preview, glm-3-turbo |
| **InternLM** | internlm3-latest, internlm3-8b-instruct<br/>internlm2.5-latest, internlm2-pro-chat |
| **Reka** | reka-core, reka-flash, reka-edge |
| **COHERE** | command-r-plus, command-r, command-light, command, command-nightly |
diff --git a/docs/mintlify/key_modules/models.mdx b/docs/mintlify/key_modules/models.mdx
index ccc7b9231..47259ebc1 100644
--- a/docs/mintlify/key_modules/models.mdx
+++ b/docs/mintlify/key_modules/models.mdx
@@ -47,7 +47,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
| **Gemini** | gemini-3.1-pro-preview, gemini-3.1-flash-lite-preview<br/>gemini-3-pro-preview, gemini-3-flash-preview<br/>gemini-2.5-pro, gemini-2.5-flash<br/>gemini-2.0-flash, gemini-2.0-flash-exp<br/>gemini-2.0-flash-thinking-exp, gemini-2.0-pro-exp-02-05<br/>gemini-2.0-flash-lite, gemini-2.0-flash-lite-preview-02-05 |
| **Qwen** | qwen3-coder-plus<br/>qwen-max, qwen-plus, qwen-turbo, qwen-long<br/>qwen-plus-latest, qwen-plus-2025-04-28, qwen-turbo-latest, qwen-turbo-2025-04-28<br/>qwen-vl-max, qwen-vl-plus, qwen2.5-vl-72b-instruct<br/>qwen-math-plus, qwen-math-turbo, qwen-coder-turbo<br/>qwen2.5-coder-32b-instruct, qwen2.5-72b-instruct, qwen2.5-32b-instruct, qwen2.5-14b-instruct<br/>qwq-32b-preview, qwq-plus, qvq-72b-preview |
| **DeepSeek** | deepseek-v4-flash, deepseek-v4-pro<br/>deepseek-chat, deepseek-reasoner |
-| **ZhipuAI** | glm-5, glm-4.7, glm-4.7-flash, glm-4.7-flashx<br/>glm-4.6, glm-4.6v, glm-4.6v-flash, glm-4.6v-flashx<br/>glm-4.5v, glm-4.5-air, glm-4.5-airx, glm-4.5-flash<br/>glm-4, glm-4v, glm-4v-flash<br/>glm-4v-plus-0111, glm-4-plus, glm-4-air<br/>glm-4-air-0111, glm-4-airx, glm-4-long<br/>glm-4-flashx, glm-4-flashx-250414<br/>glm-4-flash, glm-4-flash-250414<br/>glm-4.1v-thinking-flash, glm-4.1v-thinking-flashx<br/>glm-zero-preview, glm-3-turbo |
+| **ZhipuAI** | glm-5.2, glm-5.1, glm-5, glm-4.7, glm-4.7-flash, glm-4.7-flashx<br/>glm-4.6, glm-4.6v, glm-4.6v-flash, glm-4.6v-flashx<br/>glm-4.5v, glm-4.5-air, glm-4.5-airx, glm-4.5-flash<br/>glm-4, glm-4v, glm-4v-flash<br/>glm-4v-plus-0111, glm-4-plus, glm-4-air<br/>glm-4-air-0111, glm-4-airx, glm-4-long<br/>glm-4-flashx, glm-4-flashx-250414<br/>glm-4-flash, glm-4-flash-250414<br/>glm-4.1v-thinking-flash, glm-4.1v-thinking-flashx<br/>glm-zero-preview, glm-3-turbo |
| **InternLM** | internlm3-latest, internlm3-8b-instruct<br/>internlm2.5-latest, internlm2-pro-chat |
| **Reka** | reka-core, reka-flash, reka-edge |
| **COHERE** | command-r-plus, command-r, command-light, command, command-nightly |
diff --git a/docs/mintlify/reference/camel.configs.zhipuai_config.mdx b/docs/mintlify/reference/camel.configs.zhipuai_config.mdx
index 4adc83b29..157a66e7e 100644
--- a/docs/mintlify/reference/camel.configs.zhipuai_config.mdx
+++ b/docs/mintlify/reference/camel.configs.zhipuai_config.mdx
@@ -23,3 +23,4 @@ Reference: https://open.bigmodel.cn/dev/api#glm-4v
- **tools** (list[FunctionTool], optional): A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
- **tool_choice** (Union[dict[str, str], str], optional): Controls which (if any) tool is called by the model. :obj:`"none"` means the model will not call any tool and instead generates a message. :obj:`"auto"` means the model can pick between generating a message or calling one or more tools. :obj:`"required"` means the model must call one or more tools. Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. :obj:`"none"` is the default when no tools are present. :obj:`"auto"` is the default if tools are present.
- **interleaved_thinking** (Optional[bool], optional): Whether to enable interleaved thinking mode for GLM-4.5+ models. When enabled, the model reasons before each response and tool call. (default: :obj:`None`)
+- **reasoning_effort** (str, optional): Controls reasoning depth for GLM-5.2. Supported values are provider-defined. (default: :obj:`None`)
diff --git a/test/models/test_zhipuai_model.py b/test/models/test_zhipuai_model.py
index 78c102f14..737435c5b 100644
--- a/test/models/test_zhipuai_model.py
+++ b/test/models/test_zhipuai_model.py
@@ -26,7 +26,11 @@ from camel.utils import OpenAITokenCounter
@pytest.mark.parametrize(
"model_type",
[
- # GLM-4.7 series (latest)
+ # GLM-5 series (latest)
+ ModelType.GLM_5_2,
+ ModelType.GLM_5_1,
+ ModelType.GLM_5,
+ # GLM-4.7 series
ModelType.GLM_4_7,
ModelType.GLM_4_7_FLASHX,
ModelType.GLM_4_7_FLASH,
@@ -70,6 +74,30 @@ def test_zhipuai_model(model_type: ModelType, monkeypatch):
assert isinstance(model.token_counter, OpenAITokenCounter)
assert isinstance(model.model_type.value_for_tiktoken, str)
assert isinstance(model.model_type.token_limit, int)
+ assert model.model_type.is_zhipuai
+
+
+def test_zhipuai_glm_5_2_token_limit():
+ assert ModelType.GLM_5_2.token_limit == 1_000_000
+
+
+def test_zhipuai_glm_5_1_token_limit():
+ assert ModelType.GLM_5_1.token_limit == 200_000
+
+
+def test_zhipuai_model_reasoning_effort_config(monkeypatch):
+ monkeypatch.setenv("ZHIPUAI_API_KEY", "test_key")
+ config = ZhipuAIConfig(reasoning_effort="high")
+ model = ZhipuAIModel(
+ ModelType.GLM_5_2,
+ model_config_dict=config.as_dict(),
+ )
+
+ request_config = model._prepare_request_config()
+ assert request_config["reasoning_effort"] == "high"
@pytest.mark.model_backend