UNPKG

@mastra/core

Version:

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

33 lines (20 loc) 857 B
# dataset.getItem() **Added in:** `@mastra/core@1.4.0` Retrieves a single dataset item by ID, optionally at a specific dataset version. ## Usage example ```typescript import { Mastra } from '@mastra/core' const mastra = new Mastra({ /* storage config */ }) const dataset = await mastra.datasets.get({ id: 'dataset-id' }) // Get latest version of an item const item = await dataset.getItem({ itemId: 'item-id' }) // Get item at a specific dataset version const versionedItem = await dataset.getItem({ itemId: 'item-id', version: 2 }) ``` ## Parameters **itemId** (`string`): The unique identifier of the item. **version** (`number`): Dataset version to retrieve the item at. Defaults to the latest version. ## Returns **result** (`Promise<DatasetItem | null>`): The dataset item, or null if not found. See dataset.addItem() for the item shape.