feat: add smooth stream (#722)

This commit is contained in:
Jeremy 2025-01-23 01:53:41 +05:30 committed by GitHub
parent 3f9d379a6a
commit 5e8cddc886
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 52 additions and 20 deletions

View file

@ -2,6 +2,7 @@ import {
type Message,
convertToCoreMessages,
createDataStreamResponse,
smoothStream,
streamText,
} from 'ai';
@ -99,6 +100,7 @@ export async function POST(request: Request) {
messages: coreMessages,
maxSteps: 5,
experimental_activeTools: allTools,
experimental_transform: smoothStream({ chunking: 'word' }),
tools: {
getWeather,
createDocument: createDocument({ session, dataStream, model }),