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

getClassifierById()

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

Usage example
Usage example的直接链接

import { mastra } from './mastra'

const safety = mastra.getClassifierById('safety')

Parameters
Parameters的直接链接

id:

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

Returns
Returns的直接链接

classifier:

Classifier
The Classifier instance with the matching id or key.

Error handling
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