Streaming with function calling


I am trying to use function calling with streaming on, I am struggling with rebuilding the chat completion message from the chunks in the stream object, this is required for feeding the function output back to the chat.

Has anyone managed to make it to work?

Thanks in advance.

Solved the problem by sending dump the response into JSON and sent it back as an assistant message.

Yep, stream the message/content in the response to the chat to and at the same time store the entire stream in a buffer. When the stream is complete validate the json in the buffer, get the function call stuff and run it. Pretty cave-man but reliable.

1 Like

As this topic has a selected solution, closing this topic.