跳到主要内容
非官方简体中文翻译,内容版权归 Mastra 所有,遵循 Apache-2.0 许可。

dataset.getExperiment()

Added in: @mastra/core@1.4.0

Retrieves a specific experiment (run) by its ID.

Usage example
Usage example的直接链接

import { Mastra } from '@mastra/core'

const mastra = new Mastra({/* storage config */})

const dataset = await mastra.datasets.get({ id: 'dataset-id' })

const experiment = await dataset.getExperiment({ experimentId: 'exp-id' })

if (!experiment) {
throw new Error('Experiment not found')
}

console.log(`Status: ${experiment.status}`)
console.log(`${experiment.succeededCount}/${experiment.totalItems} succeeded`)

Parameters
Parameters的直接链接

experimentId:

string
ID of the experiment to retrieve.

Returns
Returns的直接链接

result:

Promise<Experiment | null>
The experiment record, or null if no experiment with that ID exists in this dataset. See dataset.listExperiments() for the full shape.
On this page