ai-functions
Version:
A powerful TypeScript library for building AI-powered applications with template literals and structured outputs
19 lines • 512 B
JavaScript
import { createOpenAI } from '@ai-sdk/openai';
// Create a singleton OpenAI client
let clientInstance;
export function getOpenAIClient() {
if (!clientInstance) {
clientInstance = createOpenAI({
baseURL: process.env.AI_GATEWAY,
});
}
return clientInstance;
}
export function convertToOpenAIModel(model) {
if (typeof model === 'string') {
const client = getOpenAIClient();
return client(model);
}
return model;
}
//# sourceMappingURL=model.js.map