Skip to main content

getClassifierById()

The getClassifierById() method retrieves a classifier by searching for its id property, then falls back to the registration key.

Usage example
Direct link to Usage example

import { mastra } from './mastra'

const safety = mastra.getClassifierById('safety')

Parameters
Direct link to Parameters

id:

string
The id property of the classifier to retrieve, or its registration key.

Returns
Direct link to Returns

classifier:

Classifier
The Classifier instance with the matching id or key.

Error handling
Direct link to Error handling

This method throws a MastraError with id MASTRA_GET_CLASSIFIER_BY_ID_NOT_FOUND if no classifier matches the specified id or key.

On this page