From 886454e8e73769bab304a8a3d02cd5ce149fb75b Mon Sep 17 00:00:00 2001 From: Keyang Ru Date: Mon, 18 Aug 2025 13:02:10 -0700 Subject: [PATCH] [MISC] use dynamic choices for tool-call-parser argument (#9316) --- python/sglang/srt/server_args.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index fdd1f80dd..78515e898 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -23,6 +23,7 @@ import sys import tempfile from typing import List, Literal, Optional, Union +from sglang.srt.function_call.function_call_parser import FunctionCallParser from sglang.srt.hf_transformers_utils import check_gguf_file, get_config from sglang.srt.layers.utils import is_sm90_supported, is_sm100_supported from sglang.srt.lora.lora_registry import LoRARef @@ -1231,23 +1232,13 @@ class ServerArgs: default=ServerArgs.reasoning_parser, help=f"Specify the parser for reasoning models, supported parsers are: {list(ReasoningParser.DetectorMap.keys())}.", ) + tool_call_parser_choices = list(FunctionCallParser.ToolCallParserEnum.keys()) parser.add_argument( "--tool-call-parser", type=str, - choices=[ # TODO: use FunctionCallParser.DetectorMap.keys() - "qwen25", - "mistral", - "llama3", - "deepseekv3", - "pythonic", - "kimi_k2", - "qwen3_coder", - "glm45", - "step3", - "gpt-oss", - ], + choices=tool_call_parser_choices, default=ServerArgs.tool_call_parser, - help="Specify the parser for handling tool-call interactions. Options include: 'qwen25', 'mistral', 'llama3', 'deepseekv3', 'pythonic', 'kimi_k2', 'qwen3_coder', 'glm45', and 'step3'.", + help=f"Specify the parser for handling tool-call interactions. Options include: {tool_call_parser_choices}.", ) parser.add_argument( "--tool-server",