UNPKG

@mastra/core

Version:

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

60 lines 2.72 kB
import type { LanguageModelV3, LanguageModelV3CallOptions } from '@ai-sdk/provider-v6'; import type { MastraLanguageModelV3 } from '../../shared.types.js'; type StreamResult = Awaited<ReturnType<LanguageModelV3['doStream']>>; /** * Wrapper class for AI SDK V6 (LanguageModelV3) that converts doGenerate to return * a stream format for consistency with Mastra's streaming architecture. */ export declare class AISDKV6LanguageModel implements MastraLanguageModelV3 { #private; /** * The language model must specify which language model interface version it implements. */ readonly specificationVersion: 'v3'; /** * Name of the provider for logging purposes. */ readonly provider: string; /** * Provider-specific model ID for logging purposes. */ readonly modelId: string; /** * Supported URL patterns by media type for the provider. * * The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`). * and the values are arrays of regular expressions that match the URL paths. * The matching should be against lower-case URLs. * Matched URLs are supported natively by the model and are not downloaded. * @returns A map of supported URL patterns by media type (as a promise or a plain object). */ supportedUrls: PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>; constructor(config: LanguageModelV3); doGenerate(options: LanguageModelV3CallOptions): Promise<{ request: { body?: unknown; }; response: StreamResult["response"]; stream: ReadableStream<any>; content: Array<import("@ai-sdk/provider-v6").LanguageModelV3Content>; finishReason: import("@ai-sdk/provider-v6").LanguageModelV3FinishReason; usage: import("@ai-sdk/provider-v6").LanguageModelV3Usage; providerMetadata?: import("@ai-sdk/provider-v6").SharedV3ProviderMetadata; warnings: Array<import("@ai-sdk/provider-v6").SharedV3Warning>; }>; doStream(options: LanguageModelV3CallOptions): Promise<import("@ai-sdk/provider-v6").LanguageModelV3StreamResult>; /** * Custom serialization for tracing/observability spans. * `#model` is already a true JS private field and not enumerable, so * the wrapped provider SDK client can't leak. This method makes the * safe shape explicit and avoids walking `supportedUrls` (a * PromiseLike / regex map that isn't useful in spans). */ serializeForSpan(): { specificationVersion: 'v3'; modelId: string; provider: string; }; } export {}; //# sourceMappingURL=model.d.ts.map