跳到主要内容

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 实例。