DatasetsManager.get()
添加于: @mastra/core@1.4.0
按 ID 获取现有数据集。如果数据集不存在,则抛出 MastraError。
使用示例使用示例的直接链接
import { Mastra } from '@mastra/core'
const mastra = new Mastra({/* storage config */})
const dataset = await mastra.datasets.get({ id: 'dataset-id' })
// Now use the dataset
const details = await dataset.getDetails()
console.log(details.name)
参数参数的直接链接
id:
string
数据集的唯一标识符。
返回值返回值的直接链接
如果未找到数据集,则抛出 MastraError。
result:
Promise<Dataset>
Dataset 实例。