-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ChatCompletionMessageParam - there is an TS error when trying to use content as an object #867
Closed
1 task done
Labels
bug
Something isn't working
Comments
There is a bug in your code; {
"role": "assistant",
"content": [
{
"type": "text",
"text":
"This image shows a dish composed of various cooked vegetables and what appears to be pieces of meat. The vegetables include broccoli, carrots, green beans, corn, and possibly some others. The meat is seasoned and the whole dish seems to be baked or roasted. It looks like a hearty and colorful meal!",
},
],
},
// should be:
{
"role": "assistant",
"content": "This image shows a dish composed of various cooked vegetables and what appears to be pieces of meat. The vegetables include broccoli, carrots, green beans, corn, and possibly some others. The meat is seasoned and the whole dish seems to be baked or roasted. It looks like a hearty and colorful meal!",
}, I know this is a confusing inconsistency; sorry about that! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
When we use OpenAI.chat.completions.create and define messages as in the example below. There is an error from TS "No overload matches this call."
messages: [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is this?"
}
}]
To Reproduce
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is this?"
},
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,..."
}
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "This image shows a dish composed of various cooked vegetables and what appears to be pieces of meat. The vegetables include broccoli, carrots, green beans, corn, and possibly some others. The meat is seasoned and the whole dish seems to be baked or roasted. It looks like a hearty and colorful meal!"
}
]
}
],
temperature: 1,
max_tokens: 256,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
});
Code snippets
No response
OS
macOS
Node version
v20.13.1
Library version
4.47.1
The text was updated successfully, but these errors were encountered: