2.0.5 • Published 12 days ago

@amplication/plugin-integrate-openai v2.0.5

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
12 days ago

@amplication/plugin-integrate-openai

NPM Downloads

Adds a service to use OpenAI API

Purpose

This plugin adds a module and a service to use OpenAI API, and adds the openai package as a dependency. It expose a single function createChatCompletion that can be used to create a chat completion using the OpenAI API.

const result = await this.openaiService.createChatCompletion(
  "gpt-3.5-turbo",
  [
    {
      role: "system",
      content: "This is a test system message",
    },
    {
      role: "user",
      content: "This is a test user message",
    },
  ],
  {
    temperature: 1,
    max_tokens: 2048,
    top_p: 1,
    frequency_penalty: 0,
    presence_penalty: 0,
  }
);

Configuration

This plugin requires the following environment variables: OPENAI_API_KEY=open-ai-key

Note: For development purposes, the plugin adds the variable to the .env file, but you should never use .env to hold secrets in production, and you should never check in a secrets file to source control. You should use a secrets manager like AWS Secrets Manager or Azure Key Vault to store secrets.

2.0.5

12 days ago

2.0.4

1 month ago

2.0.3

2 months ago

2.0.2

2 months ago

2.0.1

4 months ago

2.0.0

4 months ago

1.0.2

5 months ago

1.0.3

4 months ago

1.0.1

5 months ago

1.0.0

9 months ago