Stream text not working #4456
Unanswered
HuyThanh-09
asked this question in
Help
Replies: 2 comments 7 replies
-
The error message you shared is a type error saying it should look like the below. The expected content format is like this:
I see you've tried this, but you mentioned it doesn't work when you tried it this way. Can you share that error when you tried it this way? |
Beta Was this translation helpful? Give feedback.
7 replies
-
See https://sdk.vercel.ai/docs/foundations/prompts#image-parts for details on the image parts in prompts. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
const result = streamText({
model: openai('gpt-4o-mini'),
system: 'You are a helpful assistant.',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: messages },
{
type: "image_url",
image_url: {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
},
},
],
},
],
});
Type '({ type: "text"; text: any; } | { type: "image_url"; image_url: { url: string; }; })[]' is not assignable to type 'string'.ts(2322)
index.d.ts(752, 5): The expected type comes from property 'content' which is declared here on type 'UIMessage'
I'm using OpenAi, if I change to
content: [
{ type: 'text', text: message },
{ type: 'image', image: url },
], as example in AI sdk it will not work
Beta Was this translation helpful? Give feedback.
All reactions