本页还没有译文
本页 10 段还没译成简体中文,下面显示的是英文原文。valibotSchema
还没翻译译自英文(ai-sdk.dev)本页 10 段都还没译
valibotSchema is a helper function that converts a Valibot schema into a JSON schema object
that is compatible with the AI SDK.
It takes a Valibot schema as input, and returns a typed schema.
You can use it to generate structured data and in tools.
Example
import { valibotSchema } from '@ai-sdk/valibot';
import { object, string, array } from 'valibot';
const recipeSchema = valibotSchema(
object({
name: string(),
ingredients: array(
object({
name: string(),
amount: string(),
}),
),
steps: array(string()),
}),
);Import
import { valibotSchema } from "@ai-sdk/valibot"API Signature
Parameters
valibotSchema(GenericSchema<unknown, T>): The Valibot schema definition.
Returns
A Schema object that is compatible with the AI SDK, containing both the JSON schema representation and validation functionality.
AI 翻译查看英文原文