To use the OpenAI LLM models, you need a API key from OpenAI. You can alternatively use Azure OpenAI to run most of the OpenAI LLMs. Read the Azure OpenAI section to learn more about this.

To get started, obtain an API Key from OpenAI. You can do this by visiting their API Portal. Once you obtain a key, set it in an environment variable, like so -

OPENAI_API_KEY="<Your key>"

Install OpenAI addon

npm install @llm-tools/embedjs-openai

Usage

import { RAGApplicationBuilder } from '@llm-tools/embedjs';

import { OpenAi } from '@llm-tools/embedjs-openai';



const app = await new RAGApplicationBuilder()

.setModel(new OpenAi({ model: "text-davinci-003" }))