feat: emit ToolCallStart and ToolResult stream chunks#97
Merged
ishaksebsib merged 30 commits intoMar 23, 2026
Conversation
rijkvanzanten
approved these changes
Mar 2, 2026
rijkvanzanten
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Ideally we add the toolcall to the delta as well so we get streaming arguments for tool calls, but I'm happy to do that as a follow-up PR if that's easier
Member
|
@razorback16, Wanted to push some changes (related to adding more variants) to this PR but I was getting this error. was wondering if there are any collaborator settings to configure on your side. |
c787be7 to
f0a3725
Compare
Contributor
Author
|
I have finished the pull request. Please have a look @surafelfikru @rijkvanzanten |
Add two new LanguageModelStreamChunkType variants that are emitted around tool execution in stream_text: ToolCallStart (before) carries ToolCallInfo with the tool name and input, ToolResult (after) carries ToolResultInfo with the output. This allows consumers to display tool calls and results in real time without workarounds.
- replace legacy ToolCall(String) chunk with structured ToolCallDelta - emit tool-call deltas in OpenAI/Anthropic/Google streaming paths - wire OpenAI Responses SSE function-call argument delta/done events - propagate real tool ids/names in Vercel UI stream mapping - add stream_tool_probe example and fix its warning output
…ummaryTextDone SSE events
…on, forward all delta chunks
… LanguageModelStreamChunkType
…ng and tool calls
Replace deprecated Start/Text variant references in mock stream tests with the renamed TextStart/TextDelta variants across openai, anthropic, and google provider test suites.
ff74243 to
5e840e9
Compare
…s NotSupported chunks
reqwest_eventsource fires Event::Open on connection before any data events.
All three provider clients mapped this to NotSupported("{}"), which leaked
into the stream channel as the first item and caused mock tests to panic on
the TextDelta assertion.
Filter Event::Open before parse_stream_sse in the shared send_and_stream,
fixing all six failing stream tests. Update openai_chat_completions tests
whose first-item assertion was an artifact of the now-removed Open event.
Contributor
Author
|
@surafelfikru @ishaksebsib any update on merging this pull request? |
…call is ready for execution
ishaksebsib
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tool_call_idandtool_name#103, bug: Tool calls are swallowed instream_text()#102.ToolCall(String)streaming chunk with structuredToolCallDelta { tool_call_id, tool_name, delta }.ToolCallDeltain provider streaming paths for Anthropic, Google, and OpenAI.response.output_item.addedresponse.output_item.doneresponse.function_call_arguments.deltaresponse.function_call_arguments.donetool-call-start/tool-call-delta/tool-call-endwith real tool ids/names (no hardcodedunknownpath in normal flows).examples/stream_tool_probe.rsfor provider-level real-world streaming verification.Test plan
cargo test --allcargo clippy --all -- -D warningscargo fmt --all -- --checkcargo run --example stream_tool_probe --features "openai" -- openai bothcargo run --example stream_tool_probe --features "google" -- google bothcargo run --example stream_tool_probe --features "anthropic" -- anthropic bothReal-world verification notes
ToolCallDeltachunks in streaming (core + Vercel UI path), which was previously missing.