diff --git a/docs/advanced_features/tool_parser.ipynb b/docs/advanced_features/tool_parser.ipynb index fd88b6799..6ef2e321f 100644 --- a/docs/advanced_features/tool_parser.ipynb +++ b/docs/advanced_features/tool_parser.ipynb @@ -17,14 +17,18 @@ "\n", "| Parser | Supported Models | Notes |\n", "|---|---|---|\n", + "| `deepseekv3` | DeepSeek-v3 (e.g., `deepseek-ai/DeepSeek-V3-0324`) | Recommend adding `--chat-template ./examples/chat_template/tool_chat_template_deepseekv3.jinja` to launch command. |\n", + "| `deepseekv31` | DeepSeek-V3.1 and DeepSeek-V3.2 (e.g. `deepseek-ai/DeepSeek-V3.1`, `deepseek-ai/DeepSeek-V3.2-Exp`) | Recommend adding `--chat-template ./examples/chat_template/tool_chat_template_deepseekv31.jinja` (Or ..deepseekv32.jinja for DeepSeek-V3.2) to launch command. |\n", + "| `glm` | GLM series (e.g. `zai-org/GLM-4.6`) | |\n", + "| `gpt-oss` | GPT-OSS (e.g., `openai/gpt-oss-120b`, `openai/gpt-oss-20b`, `lmsys/gpt-oss-120b-bf16`, `lmsys/gpt-oss-20b-bf16`) | The gpt-oss tool parser filters out analysis channel events and only preserves normal text. This can cause the content to be empty when explanations are in the analysis channel. To work around this, complete the tool round by returning tool results as `role=\"tool\"` messages, which enables the model to generate the final content. |\n", + "| `kimi_k2` | `moonshotai/Kimi-K2-Instruct` | |\n", "| `llama3` | Llama 3.1 / 3.2 / 3.3 (e.g. `meta-llama/Llama-3.1-8B-Instruct`, `meta-llama/Llama-3.2-1B-Instruct`, `meta-llama/Llama-3.3-70B-Instruct`) | |\n", "| `llama4` | Llama 4 (e.g. `meta-llama/Llama-4-Scout-17B-16E-Instruct`) | |\n", "| `mistral` | Mistral (e.g. `mistralai/Mistral-7B-Instruct-v0.3`, `mistralai/Mistral-Nemo-Instruct-2407`, `mistralai/Mistral-7B-v0.3`) | |\n", - "| `qwen25` | Qwen 2.5 (e.g. `Qwen/Qwen2.5-1.5B-Instruct`, `Qwen/Qwen2.5-7B-Instruct`) and QwQ (i.e. `Qwen/QwQ-32B`) | For QwQ, reasoning parser can be enabled together with tool call parser. See [reasoning parser](https://docs.sglang.ai/backend/separate_reasoning.html). |\n", - "| `deepseekv3` | DeepSeek-v3 (e.g., `deepseek-ai/DeepSeek-V3-0324`) | |\n", - "| `gpt-oss` | GPT-OSS (e.g., `openai/gpt-oss-120b`, `openai/gpt-oss-20b`, `lmsys/gpt-oss-120b-bf16`, `lmsys/gpt-oss-20b-bf16`) | The gpt-oss tool parser filters out analysis channel events and only preserves normal text. This can cause the content to be empty when explanations are in the analysis channel. To work around this, complete the tool round by returning tool results as `role=\"tool\"` messages, which enables the model to generate the final content. |\n", - "| `kimi_k2` | `moonshotai/Kimi-K2-Instruct` | |\n", - "| `pythonic` | Llama-3.2 / Llama-3.3 / Llama-4 | Model outputs function calls as Python code. Requires `--tool-call-parser pythonic` and is recommended to use with a specific chat template. |\n" + "| `pythonic` | Llama-3.2 / Llama-3.3 / Llama-4 | Model outputs function calls as Python code. Requires `--tool-call-parser pythonic` and is recommended to use with a specific chat template. |\n", + "| `qwen` | Qwen series (e.g. `Qwen/Qwen3-Next-80B-A3B-Instruct`, `Qwen/Qwen3-VL-30B-A3B-Thinking`) except Qwen3-Coder| |\n", + "| `qwen3_coder` | Qwen3-Coder (e.g. `Qwen/Qwen3-Coder-30B-A3B-Instruct`) | |\n", + "| `step3` | Step-3 | |\n" ] }, { diff --git a/python/sglang/srt/function_call/function_call_parser.py b/python/sglang/srt/function_call/function_call_parser.py index e568d77fa..56588cb1c 100644 --- a/python/sglang/srt/function_call/function_call_parser.py +++ b/python/sglang/srt/function_call/function_call_parser.py @@ -35,17 +35,19 @@ class FunctionCallParser: """ ToolCallParserEnum: Dict[str, Type[BaseFormatDetector]] = { - "llama3": Llama32Detector, - "qwen25": Qwen25Detector, - "mistral": MistralDetector, "deepseekv3": DeepSeekV3Detector, "deepseekv31": DeepSeekV31Detector, - "pythonic": PythonicDetector, - "kimi_k2": KimiK2Detector, - "qwen3_coder": Qwen3CoderDetector, + "glm": Glm4MoeDetector, "glm45": Glm4MoeDetector, - "step3": Step3Detector, "gpt-oss": GptOssDetector, + "kimi_k2": KimiK2Detector, + "llama3": Llama32Detector, + "mistral": MistralDetector, + "pythonic": PythonicDetector, + "qwen": Qwen25Detector, + "qwen25": Qwen25Detector, + "qwen3_coder": Qwen3CoderDetector, + "step3": Step3Detector, } def __init__(self, tools: List[Tool], tool_call_parser: str): diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index 63a98b520..401875ff7 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -528,7 +528,13 @@ class ServerArgs: self._handle_other_validations() def _handle_deprecated_args(self): - pass + # handle deprecated tool call parsers + deprecated_tool_call_parsers = {"qwen25": "qwen", "glm45": "glm"} + if self.tool_call_parser in deprecated_tool_call_parsers: + logger.warning( + f"The tool_call_parser '{self.tool_call_parser}' is deprecated. Please use '{deprecated_tool_call_parsers[self.tool_call_parser]}' instead." + ) + self.tool_call_parser = deprecated_tool_call_parsers[self.tool_call_parser] def _handle_missing_default_values(self): if self.tokenizer_path is None: