"tool_choice" = "any"
)
mode or mixed mode ("auto" = "any"
). The format is fully compatible with OpenAI streaming.
How to Use
Similar as the message streaming. All you need to do is to setstream=true
when
calling the chat completions api. This returns an object that streams
the response as data-only server-sent events.
To extract chunks,
use the delta field instead of the message field.
Specifically, the streaming mode of tool use will guarantee to have the function name return as a
single chunk then streaming the arguments. (See the code example)
Code Example
In this example, we demonstrate how to use the streaming mode for calling tools, which will trigger two functions, and how to process their responses.python