UNPKG

@mastra/core

Version:
31 lines • 1.56 kB
import type { ModelFacingValidationError } from '../../tools/validation.js'; /** * Normalize modelOutput from toModelOutput() into the lossless V2-authored * storage shape kept in `providerMetadata.mastra.modelOutput`. * * Base64 payloads (`image-data`/`file-data`, and `image-url` parts carrying a * `data:` URI) are stored as the V2 `media` content type. Remote-URL parts * (`image-url`/`file-url`) are kept as-is because `media.data` is Base64-only — * the spec-boundary prompt converters (aiV5PromptToAIV6Prompt / * aiV5PromptToAIV7Prompt) emit the correct URL-shaped part for the target * model's specification version. * * `providerOptions` and any other author-supplied keys are preserved. */ export declare function normalizeModelOutput(output: unknown): unknown; /** * Model output for a tool that declares `toModelOutput` but resolved with a * validation error that Mastra's own validation produced (input, request * context, suspend data or output validation failed). * * The mapper is typed to receive only the tool's output, so it is skipped and * the model receives the model-facing form of the error, which leaves out the * raw values the full error quotes. Tagging it `error-json` keeps the * provider-level error flag (for example Anthropic's `is_error`) so the model * treats the call as failed and can retry. */ export declare function validationErrorModelOutput(error: ModelFacingValidationError): { type: 'error-json'; value: ModelFacingValidationError; }; //# sourceMappingURL=normalize-model-output.d.ts.map