UNPKG

@genkit-ai/compat-oai

Version:

Genkit AI framework plugin for OpenAI APIs.

58 lines 2.08 kB
"use strict"; 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 embedder_exports = {}; __export(embedder_exports, { SUPPORTED_EMBEDDING_MODELS: () => SUPPORTED_EMBEDDING_MODELS, TextEmbeddingConfigSchema: () => TextEmbeddingConfigSchema }); module.exports = __toCommonJS(embedder_exports); var import_genkit = require("genkit"); const TextEmbeddingConfigSchema = import_genkit.z.object({ dimensions: import_genkit.z.number().optional(), encodingFormat: import_genkit.z.union([import_genkit.z.literal("float"), import_genkit.z.literal("base64")]).optional() }); const COMMON_EMBEDDER_INFO = { dimensions: 1536, supports: { input: ["text"] } }; function commonRef(name, info) { return (0, import_genkit.embedderRef)({ name, configSchema: TextEmbeddingConfigSchema, info: { ...COMMON_EMBEDDER_INFO, ...info ?? {} } }); } const SUPPORTED_EMBEDDING_MODELS = { "text-embedding-3-small": commonRef("openai/text-embedding-3-small"), "text-embedding-3-large": commonRef("openai/text-embedding-3-large", { dimensions: 3072 }), "text-embedding-ada-002": commonRef("openai/text-embedding-ada-002") }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { SUPPORTED_EMBEDDING_MODELS, TextEmbeddingConfigSchema }); //# sourceMappingURL=embedder.js.map