UNPKG

@mastra/core

Version:

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

48 lines (32 loc) 1.23 kB
# dataset.update() **Added in:** `@mastra/core@1.4.0` Updates dataset metadata, name, description, and/or schemas. Use Standard JSON Schema (Zod, Valibot, ArkType, etc.) for defining schemas. ## Usage example ```typescript import { Mastra } from '@mastra/core' import { z } from 'zod' const mastra = new Mastra({ /* storage config */ }) const dataset = await mastra.datasets.get({ id: 'dataset-id' }) // Update with plain metadata const updated = await dataset.update({ name: 'Updated QA pairs', description: 'Revised evaluation set', }) // Update with Zod schema (library that supports Standard JSON Schema) const updated2 = await dataset.update({ inputSchema: z.object({ question: z.string(), context: z.string().optional(), }), }) ``` ## Parameters **name** (`string`): New display name. **description** (`string`): New description. **metadata** (`Record<string, unknown>`): Updated metadata. **inputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for item inputs. **groundTruthSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for item ground truths. ## Returns **result** (`Promise<DatasetRecord>`): The updated dataset record. See dataset.getDetails() for the full shape.