[Core] add support for reasoning parser plugins (#28075)

Signed-off-by: walter beller-morales <walter.beller.morales@gmail.com>
This commit is contained in:
Walter Beller-Morales
2025-11-05 12:15:06 -05:00
committed by GitHub
parent c18f88c6ca
commit 752ddeacaa
6 changed files with 62 additions and 15 deletions

View File

@@ -1944,13 +1944,13 @@ def validate_api_server_args(args):
f"(chose from {{ {','.join(valid_tool_parses)} }})"
)
valid_reasoning_parses = ReasoningParserManager.list_registered()
valid_reasoning_parsers = ReasoningParserManager.list_registered()
if (
reasoning_parser := args.structured_outputs_config.reasoning_parser
) and reasoning_parser not in valid_reasoning_parses:
) and reasoning_parser not in valid_reasoning_parsers:
raise KeyError(
f"invalid reasoning parser: {reasoning_parser} "
f"(chose from {{ {','.join(valid_reasoning_parses)} }})"
f"(chose from {{ {','.join(valid_reasoning_parsers)} }})"
)
@@ -1964,6 +1964,9 @@ def setup_server(args):
if args.tool_parser_plugin and len(args.tool_parser_plugin) > 3:
ToolParserManager.import_tool_parser(args.tool_parser_plugin)
if args.reasoning_parser_plugin and len(args.reasoning_parser_plugin) > 3:
ReasoningParserManager.import_reasoning_parser(args.reasoning_parser_plugin)
validate_api_server_args(args)
# workaround to make sure that we bind the port before the engine is set up.
@@ -2013,6 +2016,9 @@ async def run_server_worker(
if args.tool_parser_plugin and len(args.tool_parser_plugin) > 3:
ToolParserManager.import_tool_parser(args.tool_parser_plugin)
if args.reasoning_parser_plugin and len(args.reasoning_parser_plugin) > 3:
ReasoningParserManager.import_reasoning_parser(args.reasoning_parser_plugin)
# Load logging config for uvicorn if specified
log_config = load_log_config(args.log_config_file)
if log_config is not None: