UNPKG

genkitx-openai

Version:

Firebase Genkit AI framework plugin for OpenAI APIs.

75 lines 1.78 kB
import { __async } from "./chunk-MLCSNVBT.mjs"; import { genkitPlugin } from "genkit/plugin"; import { OpenAI } from "openai"; import { dallE3, dallE3Model } from "./dalle.js"; import { openaiEmbedder, SUPPORTED_EMBEDDING_MODELS, textEmbedding3Large, textEmbedding3Small, textEmbeddingAda002 } from "./embedder.js"; import { gpt35Turbo, gpt45, gpt4, gpt4Turbo, gpt4Vision, gpt4o, gpt4oMini, gptModel, o1, o1Preview, o1Mini, o3Mini, SUPPORTED_GPT_MODELS } from "./gpt.js"; import { SUPPORTED_TTS_MODELS, ttsModel, tts1, tts1Hd } from "./tts.js"; import { whisper1, whisper1Model } from "./whisper.js"; const openAI = (options) => genkitPlugin("openai", (ai) => __async(void 0, null, function* () { var _a; const client = new OpenAI(options); for (const name of Object.keys(SUPPORTED_GPT_MODELS)) { gptModel(ai, name, client); } (_a = options == null ? void 0 : options.models) == null ? void 0 : _a.map((model) => { if (!model.name || !model.info || !model.configSchema) { throw new Error(`Model ${model.name} is missing required fields`); } gptModel(ai, model.name, client, model.info, model.configSchema); }); dallE3Model(ai, client); whisper1Model(ai, client); for (const name of Object.keys(SUPPORTED_TTS_MODELS)) { ttsModel(ai, name, client); } for (const name of Object.keys(SUPPORTED_EMBEDDING_MODELS)) { openaiEmbedder(ai, name, options); } })); var src_default = openAI; export { dallE3, src_default as default, gpt35Turbo, gpt4, gpt45, gpt4Turbo, gpt4Vision, gpt4o, gpt4oMini, o1, o1Mini, o1Preview, o3Mini, openAI, textEmbedding3Large, textEmbedding3Small, textEmbeddingAda002, tts1, tts1Hd, whisper1 }; //# sourceMappingURL=index.mjs.map