New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

azure-openai

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

azure-openai

Node.js library for the Azure OpenAI API

0.0.12
Source
npm
Version published
Weekly downloads
2.3K
-20.83%
Maintainers
1
Weekly downloads
 
Created
Source

Azure OpenAI Node.js Library

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.

This library allows you to use Azure OpenAI's API without making any changes to your existing OpenAI code. You can simply add Azure information to your configuration and start using the Azure OpenAI model.

Installation

To install this library, use the following command:

$ npm install azure-openai

Usage

The library needs to be configured with your Azure OpenAI's key, endpoint and deploymentId. you can obtain these credentials from Azure Portal. Please see the below screenshot: image

To migrate from the official OpenAI model to the Azure OpenAI model, you can just simply add azure info into configuration to migrate, that is it. You donot need to change any code. Please see the below steps:

  • Install the library by running the following command:

    npm install azure-openai
    
  • Update the import statement from "openai" to "azure-openai":

    //import { Configuration, OpenAIApi } from "openai"; 
    import { Configuration, OpenAIApi } from "azure-openai"; 
    
  • Add the Azure OpenAI information to your project configuration:

    this.openAiApi = new OpenAIApi(
       new Configuration({
          apiKey: this.apiKey,
          azure: {
             apiKey: {your-azure-openai-resource-key},
             endpoint: {your-azure-openai-resource-endpoint},
             deploymendName: {your-azure-openai-resource-deployment-name},
          }
       }),
    );
    
  • run your code. That's it.

Test

Currently, only "gpt-3.5-turbo" API has been tested. Please feel free to submit your issues or pull requests to support other APIs.

Keywords

azure-openai

FAQs

Package last updated on 15 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts