Next.js Discord

Discord Forum

AI SDK Client-Side Function Calling

Unanswered
Blue Mockingbird posted this in #help-forum
Open in Discord
Blue MockingbirdOP
Hello,
I'm encountering an issue where sometimes if the function call isn't at the beginning of the streamed message, it gets appended to the usual assistant message stream.

By the way, I'm handling the function call on the client-side, so the server side isn't running the function.
(
  const { messages, input, handleInputChange, handleSubmit } = useChat({
    experimental_onFunctionCall: functionCallHandler,
  })

)
---

It gets streamed as so:

I will call the function now. Give me a minute.
{"function....

5 Replies