Comments (6)
WIP PR: #2052
from ai.
A possible solution might be to enqueue a toolCall message and the error message, so that useChat
gets an updated messages
list which prevents triggerRequest
from being called again.
} catch (error) {
controller.enqueue // tool call finished with an arguments parsing error
toolResultsStreamController!.enqueue({
type: 'error',
error,
});
}
ai/packages/core/core/generate-text/run-tools-transformation.ts
Lines 118 to 123 in 0565cd7
from ai.
If I am reading this right
Unfortunately function-calling is not guaranteed to follow the schema, and there can be differences in quality from model to model.
The arguments returned may not always follow the zod schema that was given.
I don't know what is better behavior here
- stop early and tell the user that it was unable to generate arguments to the specified tool call
- continue to try again until
maxAutomaticRoundtrips
is exhausted
from ai.
For my use case, I was able to avoid an argument parsing error by being more precise with the tool and parameter descriptions.
showBarChart: {
description:
'Make a bar plot in matplotlib. The bars are positioned at x. Their dimensions are given by height. Always include the data parameter as a list of JSON objects.',
parameters: z.object({
axisKey: z.string().describe('The key to use for the x-axis.'),
data: z
.array(z.record(z.union([z.string(), z.number()])))
.describe(
'List of JSON objects for which to generate grouped bars. JSON objects must always contain axisKey as a field.'
),
title: z.string().optional().describe('Set a title for the plot.'),
yLabel: z.string().optional().describe('Set the label for the y-axis.'),
}),
},
from ai.
Reproduced.
from ai.
Cause:
- when the last message in
useChat
is an assistant message with completed tool calls, - and
streamText
only returns anerror
event, - then the checks fail and an infinite loop with the last assistant message is started.
from ai.
Related Issues (20)
- Registry not accepting google provider HOT 2
- Error in implementing in nodejs HOT 6
- getMutableAIState(key [keyof AI Context]) update() and done() didn't change object reference
- useAssistant: option to ignore annotations in text deltas
- Bedrock: can't use AWS metadata service for authentication HOT 1
- Save chat to database on onSetAIState is not working correctly if connection_limit is set to high HOT 3
- vLLM Provider HOT 1
- Ending `textStream.done()` in `streamUI()` causes another render in component after version `>=3.2.6`
- Add Azure Extensions to the Azure provider
- Add support for edit history
- Create a tool to summarise results HOT 6
- AI_TypeValidationError: Optional type validation in generateObject function. HOT 10
- Model Registry non-standard parameters
- Cannot use zod tuple() in tool schema HOT 2
- Vercel AI SDK Incompatibility with Latest Perplexity API Updates HOT 2
- stop_sequences
- json mode
- experimental_useObject onFinish
- Increased Token Limit Not Working with Claude 3.5 Sonnet HOT 4
- Let AI use multiple times tools before answering 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.