Open
Description
I found that OpenAIChatCompletionsModel
can only stream out text, but cannot stream out tool_call deltas. But I think streaming is an important feature for application that need instant responses.
There is a comment in the code that "Because we don't know the name of the function until the end of the stream, we'll save everything and yield events at the end", but I don't understand it. Could you clarify the reason why we cannot just yield ResponseFunctionCallArgumentsDeltaEvent
(openai.types.responses.response_function_call_arguments_delta_event) in ChatCompletions API?
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
rm-openai commentedon Mar 25, 2025
We get deltas that contain:
So e.g. if your function is called "get_weather", the first delta might have
get_
and the second might haveweather
. So until we receive the last delta, we don't know the name of the function.rm-openai commentedon Mar 25, 2025
In practice this doesn't seem to be a real issue so maybe we should fix this
Lightblues commentedon Mar 28, 2025
Thank you for your attention to this issue. I appreciate your insights and look forward to seeing progress on this issue.
ixjx commentedon Apr 10, 2025
+1 for this feature! I also need the ability to stream
tool_call
deltas. This would be crucial for applications that require real-time tool invocation and instant responses.cm2435 commentedon May 16, 2025
just FYI for people in this thread:
ResponseOutputItemAddedEvent
is the first outputted token of a streamed function call and contains the entire function name.See https://platform.openai.com/docs/guides/function-calling?api-mode=responses#streaming