You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@azure/openai

Package Overview
Dependencies
Maintainers
2
Versions
278
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/openai

An isomorphic client library for Azure OpenAI.

1.0.0-beta.13
npm
Version published
Weekly downloads
188K
-1.12%
Maintainers
2
Weekly downloads
 
Created

What is @azure/openai?

@azure/openai is an npm package that provides access to OpenAI's powerful language models through Azure's cloud platform. It allows developers to integrate advanced AI capabilities such as natural language understanding, text generation, and more into their applications.

What are @azure/openai's main functionalities?

Text Generation

This feature allows you to generate text based on a given prompt using OpenAI's language models. The code sample demonstrates how to create a text completion request using the 'text-davinci-003' model.

const { OpenAIClient, AzureKeyCredential } = require('@azure/openai');
const client = new OpenAIClient('<endpoint>', new AzureKeyCredential('<apiKey>'));
async function generateText() {
  const result = await client.completions.create({
    model: 'text-davinci-003',
    prompt: 'Once upon a time',
    max_tokens: 50
  });
  console.log(result.choices[0].text);
}
generateText();

Text Summarization

This feature allows you to summarize long pieces of text. The code sample shows how to create a summarization request using the 'text-davinci-003' model.

const { OpenAIClient, AzureKeyCredential } = require('@azure/openai');
const client = new OpenAIClient('<endpoint>', new AzureKeyCredential('<apiKey>'));
async function summarizeText() {
  const result = await client.completions.create({
    model: 'text-davinci-003',
    prompt: 'Summarize the following text: <your text here>',
    max_tokens: 100
  });
  console.log(result.choices[0].text);
}
summarizeText();

Language Translation

This feature allows you to translate text from one language to another. The code sample demonstrates how to create a translation request using the 'text-davinci-003' model.

const { OpenAIClient, AzureKeyCredential } = require('@azure/openai');
const client = new OpenAIClient('<endpoint>', new AzureKeyCredential('<apiKey>'));
async function translateText() {
  const result = await client.completions.create({
    model: 'text-davinci-003',
    prompt: 'Translate the following text to French: <your text here>',
    max_tokens: 100
  });
  console.log(result.choices[0].text);
}
translateText();

Other packages similar to @azure/openai

Keywords

node

FAQs

Package last updated on 17 Sep 2024

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