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

DatasetsManager.get()

Added in: @mastra/core@1.4.0

Retrieves an existing dataset by ID. Throws a MastraError if the dataset doesn't exist.

Usage example
Usage example的直接链接

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)

Parameters
Parameters的直接链接

id:

string
Unique identifier of the dataset.

Returns
Returns的直接链接

Throws MastraError if the dataset isn't found.

result:

Promise<Dataset>
A Dataset instance.
On this page