openai-openapi icon indicating copy to clipboard operation
openai-openapi copied to clipboard

adapter is not a function when calling createChatCompletion

Open mohamedcherifmo opened this issue 2 years ago • 2 comments

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"}],
          });

mohamedcherifmo avatar Mar 16 '23 13:03 mohamedcherifmo

Did you figure this out?

zamoshchin avatar Apr 12 '23 23:04 zamoshchin

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

corbanvilla avatar May 11 '23 15:05 corbanvilla

Closing this out as this repo is for our public OpenAPI spec, please post inquiries like this on https://community.openai.com

logankilpatrick avatar Sep 06 '23 01:09 logankilpatrick