Comments (1)
Solved it for now by setting maxToolRoundtrips: 0
and re-submitting for some tool calls only.
interface UseToolRoundtripsParams {
handleSubmit: (
event?: {
preventDefault?: () => void;
},
chatRequestOptions?: ChatRequestOptions,
) => void;
messages: Message[];
toolNames: string[];
}
export const useToolRoundtrips = ({
handleSubmit,
messages,
toolNames,
}: UseToolRoundtripsParams) => {
useEffect(() => {
const lastMessage = messages[messages.length - 1];
for (const toolInvocation of lastMessage?.toolInvocations || []) {
if (toolInvocation.state !== 'result') {
continue;
}
if (toolNames.includes(toolInvocation.toolName)) {
handleSubmit(undefined, { allowEmptySubmit: true });
}
}
}, [messages]);
};
from ai.
Related Issues (20)
- createStructuredFewShot prompt helper
- Error processing an error response HOT 5
- Unable to render "tool running" for client-side tools
- Server-managed state HOT 1
- useChat not sending header options in request HOT 3
- Incorrect Link for Google Vertex AI
- GoogleGenerativeAI crashes when returning value from tool call HOT 1
- Google-Vertex Tool Call Not Recognized in @ai-sdk/google-vertex v0.0.27+ HOT 2
- setThreadId is changing frequently
- generateText: provide roundtrip status HOT 6
- Using experimental_attachments with empty input doesn't append the message HOT 2
- Submit useChat messages as core messages HOT 2
- Tweak documentation for AI SDK UI -> OpenAI Assistants
- Implicit `Buffer` usage fails in Cloudflare Workers HOT 1
- Invalid JSON payload received (Google Provider). HOT 10
- Unable to get 8192 tokens back from claude using streamText() HOT 3
- Composing "streamableUI" elements throws "TypeError: Cannot read properties of null (reading 'children')" HOT 1
- When using >0 maxToolRoundTrips onFinish gets called prematurely
- Unknown name minItems - Google AI SDK
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.