본문으로 건너뛰기

DatasetsManager.create()

추가된 버전: @mastra/core@1.4.0 새 데이터세트를 만듭니다. 스키마 정의에는 표준 JSON 스키마(Zod, Valibot, ArkType 등)를 사용합니다.

사용예
사용예에 대한 직접 링크

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
항목 입력을 위한 표준 JSON Schema입니다.

groundTruthSchema?:

StandardJSONSchemaV1
항목 정답을 위한 표준 JSON Schema입니다.

metadata?:

Record<string, unknown>
임의의 메타데이터입니다.

보고
보고에 대한 직접 링크

result:

Promise<Dataset>
새로 생성된 데이터 세트의 Dataset 인스턴스입니다.