Skip to content

fix(responses): stream tool call events in completion bridge - #19368

Merged
2 commits merged into
BerriAI:litellm_staging_01_20_2026from
victorigualada:fix/responses-streaming-tool-events
Jan 20, 2026
Merged

2 commits merged into
BerriAI:litellm_staging_01_20_2026from
victorigualada:fix/responses-streaming-tool-events

Conversation

@victorigualada

@victorigualada victorigualada commented Jan 19, 2026 •

Copy link
Copy Markdown
Contributor

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature

Changes

Emit OpenAI Responses API streaming tool-call events when using the “Responses → chat completion bridge” streaming iterator. This aligns with how both the OpenAI ResponsesAPOI stream SSE and how the OpenAI SDK consumes and expects data.

  • LiteLLMCompletionStreamingIterator now emits Responses API stream events for tool calls, not just text:

    response.output_item.added (with type="function_call")
    response.function_call_arguments.delta
    response.function_call_arguments.done
    response.output_item.done
    
  • Also recovers tool calls into the stream when they only appear in the final built response (i.e., when upstream chat streaming does not emit tool_call deltas).

Testing

Before:

data: {"type":"response.created","response":{ ... }}

data: {"type":"response.in_progress","response":{ ... }}

data: {"type":"response.output_item.added","item":{"type":"message","status":"in_progress","role":"assistant"}}

data: {"type":"response.content_part.added","part":{"type":"output_text","text":""}}

data: {"type":"response.output_text.done","item_id":"msg_8d02a9ad-b937-4b9d-bae3-04cd1460d8de","output_index":0,"content_index":0,"text":""}

data: {"type":"response.content_part.done", "part":{"type":"output_text","text":""}}

After

data: {"type":"response.created","response":{...}}

data: {"type":"response.in_progress","response":{...}}

data: {"type":"response.output_item.added", "item": {"type":"message","status":"in_progress","role":"assistant"}}

data: {"type":"response.content_part.added", "part":{"type":"output_text","text":""}}

data: {"type":"response.output_item.added","output_index":1,"item":{"type":"function_call" ...}}

data: {"type":"response.function_call_arguments.delta", "delta":"{\"text\": \"hello\"}"}

data: {"type":"response.function_call_arguments.done", "arguments":"{\"text\": \"hello\"}"}

data: {"type":"response.output_item.done", "item":{"type":"function_call", "name":"echo","arguments":"{\"text\": \"hello\"}","status":"completed"}}

data: {"type":"response.output_text.done", "text":""}

data: {"type":"response.content_part.done", "part":{"type":"output_text","text":"","annotations":[]}}

data: {"type":"response.output_item.done", "item":{"status":"completed","type":"message","role":"assistant","content":[{"type":"output_text","text":"","annotations":[]}]}}

data: {"type":"response.completed" ... }

data: [DONE]

Emit Responses API streaming events for tool calls when the underlying chat stream contains tool_call deltas, and recover tool calls into the stream when they only appear in the final response.
@vercel

vercel Bot commented Jan 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Jan 19, 2026 5:15pm

Request Review

@ghost
ghost changed the base branch from main to litellm_staging_01_20_2026 January 20, 2026 04:29
@ghost
ghost merged commit 581d086 into BerriAI:litellm_staging_01_20_2026 Jan 20, 2026
4 of 7 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…#19368)

Emit Responses API streaming events for tool calls when the underlying chat stream contains tool_call deltas, and recover tool calls into the stream when they only appear in the final response.
This pull request was closed.

This branch was successfully deployed

1 active deployment
Preview — 42d81dc2 Deployed Jan 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant