conversation-engine
Version:
A powerful wrapper around the OpenAI API, providing additional features and making it easier to interact with AI models. Seamlessly chat with your AI assistant, include context strings, and manage conversation history.
13 lines • 465 B
JavaScript
import { Configuration, OpenAIApi } from 'openai';
let openai = null;
export function configureOpenaiClient(apiKey) {
const configuration = new Configuration({ apiKey });
openai = new OpenAIApi(configuration);
}
export function getOpenaiClient() {
if (!openai) {
throw new Error('OpenAI client is not configured yet. Please call configureOpenaiClient(apiKey) first.');
}
return openai;
}
//# sourceMappingURL=configureOpenaiClient.js.map