// Package.json
“openai”: “^4.47.1”,
// file.tsx
const openai = new OpenAI({
apiKey: openAIKey,
});
// Add a message to the thread
const createdMessage = await openai.beta.threads.messages.create(
threadId!,
{
role: "user" as "user" | "assistant",
content: data.message.toString(),
}
);
This code showing me a error which is “BadRequestError: 400 Unknown parameter: ‘role’.” How i resolve this issue?