0.0.5-development • Published 10 months ago
@taskd/open-ai v0.0.5-development
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', {});
0.0.5-development
10 months ago
0.0.4-development
10 months ago
0.0.3-development
10 months ago
0.0.1-development
10 months ago