Skip to content

Commit

Permalink
docs: update stream text recipe message type (#4861)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoalbanese authored Feb 13, 2025
1 parent 3e728f9 commit 69cd41a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/cookbook/01-next/21-stream-text-with-chat-prompt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ export default function Page() {
Next, let's create the `/api/chat` endpoint that generates the assistant's response based on the conversation history.

```typescript filename='app/api/chat/route.ts'
import { CoreMessage, streamText } from 'ai';
import { streamText, UIMessage } from 'ai';
import { openai } from '@ai-sdk/openai';

export async function POST(req: Request) {
const { messages }: { messages: CoreMessage[] } = await req.json();
const { messages }: { messages: UIMessage[] } = await req.json();

const result = streamText({
model: openai('gpt-4'),
model: openai('gpt-4o'),
system: 'You are a helpful assistant.',
messages,
});
Expand Down

0 comments on commit 69cd41a

Please sign in to comment.