We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b34f9ec commit e8ff476Copy full SHA for e8ff476
1 file changed
app/api/chat/route.ts
@@ -87,7 +87,10 @@ export async function POST(req: Request) {
87
{ role: 'system', content: contextPrompt },
88
...(await convertToModelMessages(reqJson.messages ?? [])),
89
],
90
- toolChoice: 'auto',
+ prepareStep: ({ stepNumber }) =>
91
+ stepNumber === 0 && reqJson.messages?.length === 1
92
+ ? { toolChoice: 'required' }
93
+ : { toolChoice: 'auto' },
94
});
95
96
return result.toUIMessageStreamResponse();
0 commit comments