@taskd/open-ai
v0.0.5-development
Published
`npm run @taskd/open-ai` or `yarn add @taskd/open-ai`.
Downloads
2
Readme
OpenAI Wrapper
npm run @taskd/open-ai
or yarn add @taskd/open-ai
.
Look at src/chat-completion/real.test.ts
and src/embedding/real.test.ts
.
Setup
Make sure you set your process.env.OPENAI_API_KEY
ChatCompletion
import OpenAI, { createEmbedding } from '@taskd/open-ai';
const instance = new OpenAI('api_key', 'gpt-3.5-turbo', 1000, 0.0);
const messages = [{ role: 'system', content: 'Hello!' }];
const opts = { messages }; // put any additional official openai params in here.
const apiCall = await instance.generate(opts);
Embedding
const instance = new createEmbedding('api_key', 'gpt-3.5-turbo');
const apiCall = await instance.generate('hello', {});