Skip to content

Commit e8ff476

Browse files
committed
git status
1 parent b34f9ec commit e8ff476

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

app/api/chat/route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ export async function POST(req: Request) {
8787
{ role: 'system', content: contextPrompt },
8888
...(await convertToModelMessages(reqJson.messages ?? [])),
8989
],
90-
toolChoice: 'auto',
90+
prepareStep: ({ stepNumber }) =>
91+
stepNumber === 0 && reqJson.messages?.length === 1
92+
? { toolChoice: 'required' }
93+
: { toolChoice: 'auto' },
9194
});
9295

9396
return result.toUIMessageStreamResponse();

0 commit comments

Comments
 (0)