Skip to content
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

Open
1 task done
arekrzebit opened this issue May 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@arekrzebit
Copy link

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

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

@arekrzebit arekrzebit added the bug Something isn't working label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
@arekrzebit and others