1openwindow / azure-openai-node

This is a fork of the official OpenAI Node.js library that has been adapted to support the Azure OpenAI API. The objective of this library is to minimize the changes required to migrate from the official OpenAI library to Azure OpenAI or revert back to OpenAI.
https://www.npmjs.com/package/azure-openai
MIT License
79 stars 12 forks source link

Axios Error: #7

Open richardeee opened 1 year ago

richardeee commented 1 year ago

Hi, when using this library, I encountered following problem:

My Code:

  const reqBody = await req.json();
  const openAIApi = new OpenAIApi(
    new Configuration({ 
      apiKey: openAIApiKey,
      azure: {
        endpoint: openAIEndPoint,
        apiKey: openAIApiKey,
        deploymentName: openAIChatGPTDeploymentName,
      }
    })
  );
  console.log("reqBody", reqBody)
  const res = await openAIApi.createChatCompletion({
    model: openAIChatGPTDeploymentName,
    prompt: reqBody.messages,
    temperature: 0,
    frequency_penalty: 0.0,
    presence_penalty: 0.0,
    max_tokens: 1000,
  }); 

Error:

error - adapter is not a function

In my package.json:

"axios": "^1.3.4",

Is anything wrong with my code or dependencies?

1openwindow commented 1 year ago

@richardeee , can you share more error description?