데이터세트 관리자
추가된 항목: @mastra/core@1.4.0
DatasetsManager 클래스는 CRUD 작업과 데이터 세트 간 실험 비교를 비롯해 데이터 세트를 관리하는 공개 API를 제공합니다. mastra.datasets를 통해 접근합니다.
사용 예사용 예에 대한 직접 링크
데이터세트 생성 및 나열데이터세트 생성 및 나열에 대한 직접 링크
src/mastra/datasets/manage.ts
import { Mastra } from '@mastra/core'
const mastra = new Mastra({/* storage config */})
// Create a dataset
const dataset = await mastra.datasets.create({
name: 'QA pairs',
description: 'Question-answer evaluation set',
})
// List all datasets
const { datasets } = await mastra.datasets.list()
데이터 세트 가져오기 및 삭제데이터 세트 가져오기 및 삭제에 대한 직접 링크
src/mastra/datasets/get-delete.ts
import { Mastra } from '@mastra/core'
const mastra = new Mastra({/* storage config */})
// Get by ID
const dataset = await mastra.datasets.get({ id: 'dataset-id' })
// Delete by ID
await mastra.datasets.delete({ id: 'dataset-id' })
실험해보기실험해보기에 대한 직접 링크
ID로 특정 실험(실행)을 조회합니다. dataset.getExperiment()와 달리 먼저 데이터 세트 참조를 가져오지 않아도 모든 데이터 세트에서 조회할 수 있습니다.
import { Mastra } from '@mastra/core'
const mastra = new Mastra({/* storage config */})
// Get experiment directly without knowing the dataset
const experiment = await mastra.datasets.getExperiment({
experimentId: 'exp-id',
})
console.log(`Dataset: ${experiment.datasetId}`)
console.log(`Status: ${experiment.status}`)
실험 비교실험 비교에 대한 직접 링크
src/mastra/datasets/compare.ts
import { Mastra } from '@mastra/core'
const mastra = new Mastra({/* storage config */})
const comparison = await mastra.datasets.compareExperiments({
experimentIds: ['exp-1', 'exp-2'],
baselineId: 'exp-1',
})
입장입장에 대한 직접 링크
DatasetsManager직접 인스턴스화되지 않습니다. 다음에서 액세스하세요.Mastra instance:
const mastra = new Mastra({/* storage config */})
const datasetsManager = mastra.datasets