UNPKG

@mastra/core

Version:
78 lines • 3.6 kB
import type { LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4StreamPart } from '../../../../_types/@ai-sdk_provider@4.0.38/dist/index.js'; import type { MastraLanguageModelV4 } from '../../shared.types.js'; type StreamResult = Awaited<ReturnType<LanguageModelV4['doStream']>>; /** * Wrapper class for AI SDK V7 (LanguageModelV4) that converts doGenerate to return * a stream format for consistency with Mastra's streaming architecture. */ export declare class AISDKV7LanguageModel implements MastraLanguageModelV4 { #private; /** * The language model must specify which language model interface version it implements. */ readonly specificationVersion: 'v4'; /** * Name of the provider for logging purposes. */ readonly provider: string; /** * Provider-specific model ID for logging purposes. */ readonly modelId: string; /** Full `provider/model` ID this model was resolved from, when known. */ id?: 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[]>; /** * Whether the wrapped provider model sends native structured output (for example * `@ai-sdk/openai-compatible` models created with `supportsStructuredOutputs: true`). */ readonly supportsStructuredOutputs?: boolean; constructor(config: LanguageModelV4); doGenerate(options: LanguageModelV4CallOptions): Promise<{ content: Array<import("../../../../_types/@ai-sdk_provider@4.0.38/dist/index.js").LanguageModelV4Content>; structuredOutputText?: string; finishReason: import("../../../../_types/@ai-sdk_provider@4.0.38/dist/index.js").LanguageModelV4FinishReason; usage: import("../../../../_types/@ai-sdk_provider@4.0.38/dist/index.js").LanguageModelV4Usage; providerMetadata?: import("../../../../_types/@ai-sdk_provider@4.0.38/dist/index.js").SharedV4ProviderMetadata; warnings: Array<import("../../../../_types/@ai-sdk_provider@4.0.38/dist/index.js").SharedV4Warning>; request: { url?: string; body?: unknown; }; response: StreamResult['response']; stream: ReadableStream<any>; }>; doStream(options: LanguageModelV4CallOptions): Promise<{ request?: { url?: string; body?: unknown; }; response?: { headers?: import("../../../../_types/@ai-sdk_provider@4.0.38/dist/index.js").SharedV4Headers; }; stream: ReadableStream<LanguageModelV4StreamPart>; }>; /** * 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: 'v4'; modelId: string; provider: string; }; } export {}; //# sourceMappingURL=model.d.ts.map