getClassifierById()
The getClassifierById() method retrieves a classifier by searching for its id property, then falls back to the registration key.
Usage exampleDirect link to Usage example
import { mastra } from './mastra'
const safety = mastra.getClassifierById('safety')
ParametersDirect link to Parameters
id:
string
The id property of the classifier to retrieve, or its registration key.
ReturnsDirect link to Returns
classifier:
Classifier
The Classifier instance with the matching id or key.
Error handlingDirect 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.
RelatedDirect link to Related
- getClassifier(): Get a classifier by its registration key
- listClassifiers(): Get all registered classifiers