Package Exports
- azure-openai
- azure-openai/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (azure-openai) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Azure OpenAI Node.js Library
this is a fork of the official OpenAI Node.js library to support the Azure OpenAI API. the objective is to minimize the changes that migrate from the official library to Azure OpenAI or revert back to OpenAI.
Installation
$ npm install azure-openai
Usage
The library needs to be configured with your account's secret key, which is available on the website. We recommend setting it as an environment variable. Here's an example of initializing the library with the API key loaded from an environment variable and creating a completion:
const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
basePath: //////////////////,
});
const openai = new OpenAIApi(configuration);
const completion = await openai.createCompletion({
model: "///////////////",
prompt: "Hello world",
});
console.log(completion.data.choices[0].text);