UNPKG

@mastra/core

Version:

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

64 lines 2.7 kB
import type { JSONSchema7, Schema } from '../../_types/@internal_ai-sdk-v5/dist/index.js'; import type { z as z3 } from 'zod/v3'; import type { z as z4 } from 'zod/v4'; import type { StandardSchemaWithJSON } from '../../schema/index.js'; export type PartialSchemaOutput<OUTPUT = undefined> = OUTPUT extends undefined ? undefined : Partial<OUTPUT>; /** * @deprecated Use StandardSchemaWithJSON from '../../schema/index.js' instead */ export type OutputSchema<OBJECT = any> = z4.ZodType<OBJECT, any> | z3.Schema<OBJECT, z3.ZodTypeDef, any> | Schema<OBJECT> | JSONSchema7 | undefined; /** * @deprecated Use StandardSchemaWithJSON from '../../schema/index.js' instead * Legacy type for schema validation. */ export type SchemaWithValidation<T = any> = z4.ZodType<T, any> | z3.Schema<T, z3.ZodTypeDef, any>; /** * @deprecated Use InferPublicSchema or InferStandardSchemaOutput from '../../schema/index.js' instead * Infer the output type from a schema */ export type InferSchemaOutput<T> = T extends z4.ZodType<infer O, any> ? O : T extends z3.Schema<infer O, z3.ZodTypeDef, any> ? O : T extends Schema<infer O> ? O : unknown; /** * @deprecated Use PublicSchema from '../../schema/index.js' instead */ export type InferZodLikeSchema<T> = T extends z4.ZodType<infer O, any> ? O : T extends z3.Schema<infer O, z3.ZodTypeDef, any> ? O : unknown; export type ZodLikePartialSchema<T = any> = (z4.core.$ZodType<Partial<T>, any> & { safeParse(value: unknown): { success: boolean; data?: Partial<T>; error?: any; }; }) | (z3.ZodType<Partial<T>, z3.ZodTypeDef, any> & { safeParse(value: unknown): { success: boolean; data?: Partial<T>; error?: any; }; }); export declare function asJsonSchema(schema: StandardSchemaWithJSON | undefined): JSONSchema7 | undefined; type SchemaModelInfo = { provider: string; modelId: string; supportsStructuredOutputs: boolean; }; export declare function getTransformedSchema<OUTPUT = undefined>(schema?: StandardSchemaWithJSON<OUTPUT>, options?: { model?: SchemaModelInfo; }): { jsonSchema: JSONSchema7; outputFormat: string; } | { jsonSchema: JSONSchema7; outputFormat: import("../../_types/@internal_ai-sdk-v5/dist/index.js").JSONSchema7TypeName | import("../../_types/@internal_ai-sdk-v5/dist/index.js").JSONSchema7TypeName[] | undefined; } | undefined; export declare function getResponseFormat(schema?: StandardSchemaWithJSON, options?: { model?: SchemaModelInfo; }): { type: 'text'; } | { type: 'json'; /** * JSON schema that the generated output should conform to. */ schema?: JSONSchema7; }; export {}; //# sourceMappingURL=schema.d.ts.map