that's exactly right, but actually just trying it again, I can't replicate this. I've tried a bunch

that's exactly right, but actually just trying it again, I can't replicate this. I've tried a bunch of different things and FINALLY narrowed it down. The problem is in the messages array, when passing an array to content instead of a string, it doesn't work. Here's my code as an example: Doesn't work:
const stream = await openai.chat.completions.create({
model: "gpt-4o-mini",
stream: true,
response_format: { type: "json_object" },
messages: [
{
role: "user",
content: [
{
type: "text",
text: query
},
{
type: "image_url",
image_url: {
url: image
}
}
]
}
],
});
const stream = await openai.chat.completions.create({
model: "gpt-4o-mini",
stream: true,
response_format: { type: "json_object" },
messages: [
{
role: "user",
content: [
{
type: "text",
text: query
},
{
type: "image_url",
image_url: {
url: image
}
}
]
}
],
});
Works:
const stream = await openai.chat.completions.create({
model: "gpt-4o-mini",
stream: true,
response_format: { type: "json_object" },
messages: [
{
role: "user",
content: query
}
],
});
const stream = await openai.chat.completions.create({
model: "gpt-4o-mini",
stream: true,
response_format: { type: "json_object" },
messages: [
{
role: "user",
content: query
}
],
});
The query variable is a string in both cases So I guess Cloudflare would just need to add support for an array in this field
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?