vllm.entrypoints.openai.chat_completion.message_assembly
¶
Functions:
-
assemble_chat_message_fields–Pick the assistant message fields for one parsed chat choice.
-
keeps_tool_calls–Whether a chat choice returns the tool calls its parser extracts.
assemble_chat_message_fields(request, reasoning, content, tool_calls, *, enable_auto_tools, parser_cls)
¶
Pick the assistant message fields for one parsed chat choice.
Shared by OpenAIServingChat and batch chat derender so both surface the
same reasoning, content and tool_calls for the same parser output.
Parameters:
-
(request¶ChatCompletionRequest) –Supplies
tools,tool_choice,include_reasoningandparallel_tool_calls. -
(reasoning¶str | None) –Reasoning from
Parser.parse. -
(content¶str | None) –Content from
Parser.parseor the raw text without a parser. -
(tool_calls¶list[FunctionCall] | None) –Tool calls from
Parser.parse. -
(enable_auto_tools¶bool) –The server's
--enable-auto-tool-choice. -
(parser_cls¶type[Parser] | None) –The server's parser class, if any.
Returns:
-
ChatMessageFields–The fields for the response
ChatMessage.
Source code in vllm/entrypoints/openai/chat_completion/message_assembly.py
keeps_tool_calls(request, *, enable_auto_tools, parser_cls)
¶
Whether a chat choice returns the tool calls its parser extracts.
Shared by the non-streaming and streaming chat paths so both apply
tool_choice the same way. Parsers don't all gate on it themselves:
HarmonyParser ignores "none" and null is parsed like "auto".
Parameters:
-
(request¶ChatCompletionRequest) –Supplies
toolsandtool_choice. -
(enable_auto_tools¶bool) –The server's
--enable-auto-tool-choice. -
(parser_cls¶type[Parser] | None) –The server's parser class, if any.
Returns: