Comments (10)
This is crucial if you want to have a real conversation with an AI that can call tools. Right now I get the toolCall result back, and then I can't chat anymore.
Here's my conversation:
Me: Hi, what can you do?
AI: Hi, I can do X
Me: Ok please do X
AI: toolcall.result = Y // I would expect some commentary to come with the result here
Me: Ok thanks
AI: toolcall.result = Y
Me: What do you think about the result?
AI: toolcall.result = Y
How do you go around this behavior?
from ai.
This is possible using frontend tool calls, but tool calls for streamed responses is supposed to be coming soon. #1574 (comment)
from ai.
while a QoL update to automate round trips would be great for right now you can recursively pipe tool call responses back into your submitMessage() yourself
func myTool(){
do stuff
generate: return{submitMessage(toolResult)}
from ai.
Also interested in this – one thought is maybe the streamUI
API would benefit from keeping structured tool output separate from the desired UI (generate
function in most of the examples).
Manually piping tool output back in via submitMessage
as mentioned by @nsenthilkumar is interesting, but wouldn't that only provide additional context to the following user message in the chat history? It doesn't direct the assistant to take another step after the current tool run completes in order to make incremental progress using multiple tool invocations against the original prompt. If I'm missing something I'd love to see a more complete example.
Open to ideas but something like this would provide a history of previously called tool invocations similar to generateText
:
tools: {
getWeather: {
description: 'Get Weather',
parameters: z.object({
city: z.string().describe('The city to get weather for'),
}),
generate: async function* ({ city }) {
const weatherForCity = getWeather(city)
yield (
{
output: weatherForCity,
widget: <Weather weather={weatherForCity} />,
}
)
},
}
}
from ai.
I'm also curious how to persist tool result messages using streamUI. Right now OpenAI requires that every tool call have a corresponding tool result message on the chat history array. Since tools with streamUI return a ReactNode, are we supposed to save that serialized node as a ToolResultPart and feed that back into the history?
from ai.
I've made a support request to Vercel for this issue as well. Was very surprised there was no existing support or some other suggested workaround/solution.
from ai.
Big +1 on this
from ai.
I've made a support request to Vercel for this issue as well. Was very surprised there was no existing support or some other suggested workaround/solution.
any updates from vercel?
from ai.
Would be nice - is there a technical reason why its not possible? Like because the streamUI wants to start returning data back to the user before its got a full response and needs to wait and process the full result in case its needs to call another tool (thus defeating the purpose of streaming in the first place?). Just curious and would help developing knowing the path we need to take one way or the other.
from ai.
Would be nice - is there a technical reason why its not possible? Like because the streamUI wants to start returning data back to the user before its got a full response and needs to wait and process the full result in case its needs to call another tool (thus defeating the purpose of streaming in the first place?). Just curious and would help developing knowing the path we need to take one way or the other.
in the latest version, they added support for text stream but not stream UI https://vercel.com/blog/introducing-vercel-ai-sdk-3-2 .
from ai.
Related Issues (20)
- Receiving the error "Error: Cannot read properties of undefined (reading 'workers')" after upgrading to v3.3.30 using Next.js v14.2.9 HOT 7
- React: mutating stream data unnecessarily causes other functions being recreated even though they are enclosed by useCallback
- Add Support for Custom AI Model in StreamUI HOT 1
- Flush/Reset StreamData when calling data.close() or have a seperate function for it
- Token transfer to client should be optional HOT 2
- TypeError: Inter-TransformStream ReadableStream.pipeTo() is not implemented HOT 8
- Streaming breaks when using await in tool execution on express HOT 3
- Gemini not working with structured output and union HOT 2
- ai-sdk/ui: Provide a way to customise the user message in useChat
- Callback for each message when calling tools with streamText() e.g. `onMessage` HOT 16
- topK option is not passed from provider HOT 7
- Support for Additional Inference Providers (DeepInfra, Hyperbolic) and Voyage AI for Embeddings
- StreamUI unhandledRejection: Error: .update(): UI stream is already closed. HOT 6
- Cannot destructure property 'sendMessage' of 'useActions(...)' as it is null. HOT 1
- useAssistant hook createMessage method
- AWS Bedrock provider doesn't work unless using `bedrockOptions` HOT 3
- More granular control over supported 3rd party API provider features
- Support dangerouslyAllowBrowser for Anthropic HOT 5
- Support image input in Mistral provider HOT 1
- Invalid Type Checking on Tool Call Result HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ai.