> Discover all available pages from the documentation index: https://mastra.zisheng.pro/llms.txt # DatasetsManager.create() **添加于:** `@mastra/core@1.4.0` 创建新数据集。使用 Standard JSON Schema(Zod、Valibot、ArkType 等)定义 schema。 ## 使用示例 ```typescript import { Mastra } from '@mastra/core' import { z } from 'zod' const mastra = new Mastra({/* storage config */}) // Create with metadata const dataset = await mastra.datasets.create({ name: 'QA evaluation set', description: 'Question-answer pairs for testing', metadata: { team: 'ml' }, }) // Create with Zod schema (library that supports Standard JSON Schema) const typedDataset = await mastra.datasets.create({ name: 'Typed QA set', inputSchema: z.object({ question: z.string(), context: z.string().optional(), }), groundTruthSchema: z.object({ answer: z.string(), }), }) ``` ## 参数 **name** (`string`): 数据集的显示名称。 **description** (`string`): 数据集的描述。 **inputSchema** (`StandardJSONSchemaV1`): 条目输入的 Standard JSON Schema。 **groundTruthSchema** (`StandardJSONSchemaV1`): 条目 ground truth 的 Standard JSON Schema。 **metadata** (`Record`): 任意元数据。 ## 返回值 **result** (`Promise`): 新创建数据集的 Dataset 实例。