A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 11, 03:45 UTC
GLM-4.7 Tool Parser and Doc Update (#30876)
Signed-off-by: zRzRzRzRzRzRzR <2448370773@qq.com>
Yuxuan Zhang committed
Dec 20, 2025 at 08:09 UTC
8a7a414374909bc176cb165e8031e0e92948d07e
5 files changed
+38
-3
docs/features/tool_calling.md
+8
-1
@@ -352,10 +352,17 @@ Supported models:
352
* `zai-org/GLM-4.5`
353
* `zai-org/GLM-4.5-Air`
354
* `zai-org/GLM-4.6`
355
-* `zai-org/GLM-4.6-Air`
355
356
Flags: `--tool-call-parser glm45`
357
358
+### GLM-4.7 Models (`glm47`)
359
+
360
+Supported models:
361
+
362
+* `zai-org/GLM-4.7`
363
+
364
+Flags: `--tool-call-parser glm47`
365
+
366
### Qwen3-Coder Models (`qwen3_xml`)
367
368
Supported models:
docs/models/supported_models.md
+1
-1
@@ -387,7 +387,7 @@ th {
387
| `Gemma3nForCausalLM` | Gemma 3n | `google/gemma-3n-E2B-it`, `google/gemma-3n-E4B-it`, etc. | | |
388
| `GlmForCausalLM` | GLM-4 | `zai-org/glm-4-9b-chat-hf`, etc. | ✅︎ | ✅︎ |
389
| `Glm4ForCausalLM` | GLM-4-0414 | `zai-org/GLM-4-32B-0414`, etc. | ✅︎ | ✅︎ |
390
-| `Glm4MoeForCausalLM` | GLM-4.5, GLM-4.6 | `zai-org/GLM-4.5`, etc. | ✅︎ | ✅︎ |
390
+| `Glm4MoeForCausalLM` | GLM-4.5, GLM-4.6, GLM-4.7 | `zai-org/GLM-4.5`, etc. | ✅︎ | ✅︎ |
391
| `GPT2LMHeadModel` | GPT-2 | `gpt2`, `gpt2-xl`, etc. | | ✅︎ |
392
| `GPTBigCodeForCausalLM` | StarCoder, SantaCoder, WizardCoder | `bigcode/starcoder`, `bigcode/gpt_bigcode-santacoder`, `WizardLM/WizardCoder-15B-V1.0`, etc. | ✅︎ | ✅︎ |
393
| `GPTJForCausalLM` | GPT-J | `EleutherAI/gpt-j-6b`, `nomic-ai/gpt4all-j`, etc. | | ✅︎ |
vllm/model_executor/models/glm4_moe.py
+2
-1
@@ -21,7 +21,8 @@
21
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
# See the License for the specific language governing permissions and
23
# limitations under the License.
24
-"""Inference-only GLM-4.5, GLM-4.6 model compatible with HuggingFace weights."""
24
+"""Inference-only GLM-4.5, GLM-4.6, GLM-4.7 model
25
+compatible with HuggingFace weights."""
26
27
import typing
28
from collections.abc import Callable, Iterable
vllm/tool_parsers/__init__.py
+4
@@ -42,6 +42,10 @@ _TOOL_PARSERS_TO_REGISTER = {
42
"glm4_moe_tool_parser",
43
"Glm4MoeModelToolParser",
44
),
45
+ "glm47": (
46
+ "glm47_moe_tool_parser",
47
+ "Glm47MoeModelToolParser",
48
+ ),
49
"granite-20b-fc": (
50
"granite_20b_fc_tool_parser",
51
"Granite20bFCToolParser",
vllm/tool_parsers/glm47_moe_tool_parser.py
new
+23
@@ -0,0 +1,23 @@
1
+# SPDX-License-Identifier: Apache-2.0
2
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
+
4
+
5
+import regex as re
6
+
7
+from vllm.logger import init_logger
8
+from vllm.tokenizers import TokenizerLike
9
+from vllm.tool_parsers.glm4_moe_tool_parser import Glm4MoeModelToolParser
10
+
11
+logger = init_logger(__name__)
12
+
13
+
14
+class Glm47MoeModelToolParser(Glm4MoeModelToolParser):
15
+ def __init__(self, tokenizer: TokenizerLike):
16
+ super().__init__(tokenizer)
17
+ self.func_detail_regex = re.compile(
18
+ r"<tool_call>(.*?)(<arg_key>.*?)?</tool_call>", re.DOTALL
19
+ )
20
+ self.func_arg_regex = re.compile(
21
+ r"<arg_key>(.*?)</arg_key>(?:\\n|\s)*<arg_value>(.*?)</arg_value>",
22
+ re.DOTALL,
23
+ )