@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
36 lines • 1.3 kB
TypeScript
import type { MastraDBMessage, MessageSource } from '../state/types.js';
import type { AIV5Type } from '../types.js';
export interface AIV5AdapterContext {
memoryInfo: {
threadId?: string;
resourceId?: string;
} | null;
newMessageId?(): string;
generateCreatedAt?(messageSource: MessageSource, start?: unknown): Date;
}
/**
* AIV5Adapter - Handles conversions between MastraDBMessage and AI SDK V5 formats
*
* This adapter centralizes all AI SDK V5 (UIMessage and ModelMessage) conversion logic.
*/
export declare class AIV5Adapter {
/**
* Direct conversion from MastraDBMessage to AIV5 UIMessage
*/
static toUIMessage(dbMsg: MastraDBMessage, options?: {
transformToolPayloads?: boolean;
}): AIV5Type.UIMessage;
/**
* Direct conversion from AIV5 UIMessage to MastraDBMessage
*/
static fromUIMessage(uiMsg: AIV5Type.UIMessage): MastraDBMessage;
/**
* Convert image or file to data URI or URL for V2 file part
*/
private static getDataStringFromAIV5DataPart;
/**
* Direct conversion from AIV5 ModelMessage to MastraDBMessage
*/
static fromModelMessage(modelMsg: AIV5Type.ModelMessage, _messageSource?: MessageSource): MastraDBMessage;
}
//# sourceMappingURL=AIV5Adapter.d.ts.map