Next.js Discord

Discord Forum

How does the tool call work for a provider using doGenerate?

Unanswered
someone posted this in #help-forum
Open in Discord
I'm trying to implement a custom provider for openai assistants, i'm using the openai node lib instead of the api call used in the existing providers. How does the tool call "execute" get run and how is it passed back to submit it?

I don't understand where in here all that happens.

5 Replies

https://sdk.vercel.ai/docs/ai-sdk-core/tools-and-tool-calling
It says tool roundtrips are only available on generateText.
I'm guessing this means that since theres no way to make the round trip, the streamUI and streamText tool calls are supposed to only be used to generate the arguments for a function call without a resolution for the require action state of the run?
Looking at the streamUI source code, i don't see where it could ever resolve the require action state of the run, do we really just leave that thread hanging?
https://github.com/vercel/ai/blob/main/packages/ai/rsc/stream-ui/stream-ui.tsx
bump
Bump
bump