openai-openapi
openai-openapi copied to clipboard
adapter is not a function when calling createChatCompletion
I created the following very simple openai.createChatCompletion in a nextjs edge function as soon as it's invoked it gives the error adapter is not a function
const openai = new OpenAIApi(configuration);
const completion = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [{role: "user", content: "Hello world"}],
});
Did you figure this out?
This is your problem, the OpenAI library uses axios under the hood, which isn't allowed from the Cloudflare workerd runtime (i.e. nextjs edge)
https://github.com/openai/openai-node/issues/30
Closing this out as this repo is for our public OpenAPI spec, please post inquiries like this on https://community.openai.com