You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For tool calls which take a couple of seconds to finish, it would be useful if partial tool results were supported so that the UI can reflect incremental progress.
For server side tools, this could be implemented by allowing execute to be an AsyncGenerator. This is similar to how the generate function in streamUI allows for intermediate updates to the UI:
In both cases, we could add a new stream part toolResultDeltaStreamPart that handles this. Similar to how partial tool calls toolCallDeltaStreamPart are supported when arguments are being generated:
Feature Description
For tool calls which take a couple of seconds to finish, it would be useful if partial tool results were supported so that the UI can reflect incremental progress.
For server side tools, this could be implemented by allowing
execute
to be anAsyncGenerator
. This is similar to how thegenerate
function instreamUI
allows for intermediate updates to the UI:ai/packages/ai/README.md
Lines 136 to 141 in 8653fe5
For client side tools, it could be done with an
addPartialToolResult
.In both cases, we could add a new stream part
toolResultDeltaStreamPart
that handles this. Similar to how partial tool callstoolCallDeltaStreamPart
are supported when arguments are being generated:ai/packages/ui-utils/src/stream-parts.ts
Line 334 in 8653fe5
Use Case
Take for example a web search tool. The flow would be something like
Huggingface has a good reference implementation here of that behavior, where it emits intermediate updates to its UI.
Additional context
Tools implemented with edge functions typically time out if no response is given within a fixed limit like 10s or 30s.
A mix of returning an
event-stream
withwaitUntil
gets around that limitation.The text was updated successfully, but these errors were encountered: