[MISC] use dynamic choices for tool-call-parser argument (#9316)
This commit is contained in:
@@ -23,6 +23,7 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
from typing import List, Literal, Optional, Union
|
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.hf_transformers_utils import check_gguf_file, get_config
|
||||||
from sglang.srt.layers.utils import is_sm90_supported, is_sm100_supported
|
from sglang.srt.layers.utils import is_sm90_supported, is_sm100_supported
|
||||||
from sglang.srt.lora.lora_registry import LoRARef
|
from sglang.srt.lora.lora_registry import LoRARef
|
||||||
@@ -1231,23 +1232,13 @@ class ServerArgs:
|
|||||||
default=ServerArgs.reasoning_parser,
|
default=ServerArgs.reasoning_parser,
|
||||||
help=f"Specify the parser for reasoning models, supported parsers are: {list(ReasoningParser.DetectorMap.keys())}.",
|
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(
|
parser.add_argument(
|
||||||
"--tool-call-parser",
|
"--tool-call-parser",
|
||||||
type=str,
|
type=str,
|
||||||
choices=[ # TODO: use FunctionCallParser.DetectorMap.keys()
|
choices=tool_call_parser_choices,
|
||||||
"qwen25",
|
|
||||||
"mistral",
|
|
||||||
"llama3",
|
|
||||||
"deepseekv3",
|
|
||||||
"pythonic",
|
|
||||||
"kimi_k2",
|
|
||||||
"qwen3_coder",
|
|
||||||
"glm45",
|
|
||||||
"step3",
|
|
||||||
"gpt-oss",
|
|
||||||
],
|
|
||||||
default=ServerArgs.tool_call_parser,
|
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(
|
parser.add_argument(
|
||||||
"--tool-server",
|
"--tool-server",
|
||||||
|
|||||||
Reference in New Issue
Block a user