Add example of function call with streaming mode
Right now in our docs, the example for function call uses non streaming mode https://docs.puter.com/AI/chat/#function-calling
We would like to add example to use it in streaming mode
this should be possible given all the providers behind the scenes we use also support it
reference of function call with streaming
- https://openrouter.ai/docs/guides/features/tool-calling#streaming-with-tool-calls
- https://platform.openai.com/docs/guides/function-calling#streaming
- https://platform.claude.com/docs/en/build-with-claude/streaming#streaming-request-with-tool-use
@reynaldichernando Hi! I'd like to work on this issue. I've reviewed the provided references for OpenRouter, OpenAI, and Claude. I can help create a clear example for Puter's documentation on how to handle function calling in streaming mode.
Could you please assign this to me?
assigned! @AryaXDG
@reynaldichernando I have submitted a PR to address this: https://github.com/HeyPuter/puter/pull/2365#issuecomment-3809945940
I added a new example to src/docs/src/AI/chat.md that demonstrates how to handle Function Calling with Streaming.
Implementation Note: After checking the backend source (Streaming.js), I confirmed that Puter buffers the partial JSON chunks internally. Therefore, the new example shows how to simply listen for the tool_use event type (which delivers the fully parsed arguments) without needing manual string accumulation on the client side.
Let me know if any changes are needed!
i left some comments on the actual PR, but everything looks good, thank you!