Stream content and IFM tool calls in multi-format parser - #10
Stream content and IFM tool calls in multi-format parser#10aaryamonvikram wants to merge 2 commits into
Conversation
|
@aaryamonvikram Created some test cases that fail and should be addressed :) Assuming for example the tool calls are like the following CALL_1 = CALL_2 =
Incoming tool-parser delta: "\n" + CALL_1 Expected: content="\n" Actual: content="\n" CALL_1 remains buffered. It is lost if another delta does not arrive.
Incoming deltas: Delta 1: "<ifm|tool_calls>" + CALL_1 Expected: Delta 1: tool_calls[0]=get_weather(...) Actual: Delta 1: tool_calls[0]=get_weather(...) The parser stops emitting after its first parsed tool call.
Final tool-parser delta: CALL_1 Expected: id= Actual after finish processing: id=None The name and ID are lost, and the arguments are JSON-encoded twice.
Incoming K2-parser content: "Use <tool_call> literally in the documentation." Expected: content="Use <tool_call> literally in the documentation." Actual: content="Use " The remaining text is buffered and may never be emitted. PR #10 incorrectly treats generic <tool_call> as a K2 marker.
Incoming final engine delta: "</ifm|think>\n" + CALL_1 Expected accumulated response: reasoning="" Actual: reasoning="" The reasoning parser finds the post-reasoning text, but serving finishes without invoking the tool parser. Both the newline and tool call are lost. |
|
Addressed the comments, @hanseungwook please have a look |
|
Combined with #12 so closing |
Summary
MultiFormatToolParserformats.tool_callsdeltas.finish_reason: tool_calls.Context
When
tools+tool_choice:autois used, vLLM routes output through the tool parser after reasoning ends. The K2/IFM parser previously returnedNonein streaming mode for non-delegated formats, which caused final answer text and IFM tool calls to be suppressed.Validation
DeltaMessage(content=...)write_fileblock -> OpenAItool_callsdelta with JSON arguments