@genkit-ai/compat-oai
Version:
Genkit AI framework plugin for OpenAI APIs.
88 lines • 3.67 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var index_exports = {};
__export(index_exports, {
ChatCompletionCommonConfigSchema: () => import_model.ChatCompletionCommonConfigSchema,
ImageGenerationCommonConfigSchema: () => import_image.ImageGenerationCommonConfigSchema,
SpeechConfigSchema: () => import_audio.SpeechConfigSchema,
TranscriptionConfigSchema: () => import_audio.TranscriptionConfigSchema,
compatOaiImageModelRef: () => import_image.compatOaiImageModelRef,
compatOaiModelRef: () => import_model.compatOaiModelRef,
compatOaiSpeechModelRef: () => import_audio.compatOaiSpeechModelRef,
compatOaiTranscriptionModelRef: () => import_audio.compatOaiTranscriptionModelRef,
default: () => index_default,
defineCompatOpenAIEmbedder: () => import_embedder.defineCompatOpenAIEmbedder,
defineCompatOpenAIImageModel: () => import_image.defineCompatOpenAIImageModel,
defineCompatOpenAIModel: () => import_model.defineCompatOpenAIModel,
defineCompatOpenAISpeechModel: () => import_audio.defineCompatOpenAISpeechModel,
defineCompatOpenAITranscriptionModel: () => import_audio.defineCompatOpenAITranscriptionModel,
openAICompatible: () => openAICompatible,
openAIModelRunner: () => import_model.openAIModelRunner
});
module.exports = __toCommonJS(index_exports);
var import_plugin = require("genkit/plugin");
var import_openai = require("openai");
var import_audio = require("./audio.js");
var import_embedder = require("./embedder.js");
var import_image = require("./image.js");
var import_model = require("./model.js");
const openAICompatible = (options) => {
let listActionsCache;
return (0, import_plugin.genkitPlugin)(
options.name,
async (ai) => {
if (options.initializer) {
const client = new import_openai.OpenAI(options);
await options.initializer(ai, client);
}
},
async (ai, actionType, actionName) => {
if (options.resolver) {
const client = new import_openai.OpenAI(options);
await options.resolver(ai, client, actionType, actionName);
}
},
options.listActions ? async () => {
if (listActionsCache) return listActionsCache;
const client = new import_openai.OpenAI(options);
listActionsCache = await options.listActions(client);
return listActionsCache;
} : void 0
);
};
var index_default = openAICompatible;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ChatCompletionCommonConfigSchema,
ImageGenerationCommonConfigSchema,
SpeechConfigSchema,
TranscriptionConfigSchema,
compatOaiImageModelRef,
compatOaiModelRef,
compatOaiSpeechModelRef,
compatOaiTranscriptionModelRef,
defineCompatOpenAIEmbedder,
defineCompatOpenAIImageModel,
defineCompatOpenAIModel,
defineCompatOpenAISpeechModel,
defineCompatOpenAITranscriptionModel,
openAICompatible,
openAIModelRunner
});
//# sourceMappingURL=index.js.map