UNPKG

@maximai/maxim-js

Version:

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

19 lines (18 loc) 1.23 kB
import { LanguageModelV1 } from "ai-sdk-provider-v1"; import { LanguageModelV2 } from "ai-sdk-provider-v2"; import { LanguageModelV3 } from "ai-sdk-provider-v3"; import { MaximLogger } from "../logger"; /** * 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. */ export declare function wrapMaximAISDKModel<T extends LanguageModelV1 | LanguageModelV2 | LanguageModelV3>(model: T, logger: MaximLogger): T;