listScorers()
listScorers() 方法返回已在 Mastra 实例中注册的所有评分器。评分器用于评估 AI 输出,并且可以在代理生成或工作流执行期间覆盖默认评分器。
🌐 The listScorers() method returns all scorers that have been registered with the Mastra instance. Scorers are used for evaluating AI outputs and can override default scorers during agent generation or workflow execution.
使用示例Direct link to 使用示例
🌐 Usage Example
import { mastra } from "./mastra";
// Get all registered scorers
const allScorers = mastra.listScorers();
// Access a specific scorer
const myScorer = allScorers.relevancyScorer;
参数Direct link to 参数
🌐 Parameters
此方法不接受任何参数。
🌐 This method takes no parameters.
返回Direct link to 返回
🌐 Returns
scorers:
Record<string, MastraScorer> | undefined
An object containing all registered scorers, where keys are scorer names and values are MastraScorer instances. Returns undefined if no scorers are registered.
相关Direct link to 相关
🌐 Related
- getScorer() - 通过键获取特定的评分器
- getScorerById() - 根据其 id 属性获取评分器
- 得分者概览 - 了解如何创建和使用得分者