UNPKG

@maximai/maxim-js

Version:

Maxim AI JS SDK. Visit https://getmaxim.ai for more info.

33 lines 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.wrapMaximAISDKModel = wrapMaximAISDKModel; const wrapper_1 = require("./v1/wrapper"); const wrapperV2_1 = require("./v2/wrapperV2"); const wrapperV3_1 = require("./v3/wrapperV3"); /** * Wraps a Vercel AI SDK language model (v1, v2, or v3) with Maxim logging and tracing capabilities. * * This function routes the provided model based on its specification version (v1, v2, or v3), * and returns a wrapped version that integrates Maxim's observability features including * trace logging, generation tracking, and attachment handling. If the model specification * is not supported, it logs an error and returns the original model. * * @template T - The type of the language model (must extend LanguageModelV1, LanguageModelV2, or LanguageModelV3). * @param model - The Vercel AI SDK language model instance to wrap (supports v1, v2, and v3 specifications). * @param logger - The MaximLogger instance to use for tracing and logging. * @returns The wrapped model with Maxim integration, or the original model if the specification version is unsupported. */ function wrapMaximAISDKModel(model, logger) { if ((model === null || model === void 0 ? void 0 : model.specificationVersion) === "v1") { return new wrapper_1.MaximAISDKWrapper(model, logger); } if ((model === null || model === void 0 ? void 0 : model.specificationVersion) === "v2") { return new wrapperV2_1.MaximAISDKWrapperV2(model, logger); } if ((model === null || model === void 0 ? void 0 : model.specificationVersion) === "v3") { return new wrapperV3_1.MaximAISDKWrapperV3(model, logger); } console.error("[MaximSDK] Unsupported model"); return model; } //# sourceMappingURL=index.js.map