@mastra/evals 1.10.11 → 1.10.12-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/docs/SKILL.md +4 -5
  2. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  3. package/dist/docs/references/docs-evals-built-in-scorers.md +1 -1
  4. package/dist/docs/references/docs-evals-overview.md +5 -1
  5. package/dist/docs/references/docs-evals-quick-checks.md +1 -1
  6. package/dist/docs/references/docs-guides-build-an-eval-loop.md +1 -1
  7. package/dist/docs/references/reference-evals-answer-relevancy.md +2 -2
  8. package/dist/docs/references/reference-evals-bias.md +2 -2
  9. package/dist/docs/references/reference-evals-checks.md +1 -1
  10. package/dist/docs/references/reference-evals-completeness.md +4 -5
  11. package/dist/docs/references/reference-evals-content-similarity.md +5 -7
  12. package/dist/docs/references/reference-evals-context-precision.md +6 -6
  13. package/dist/docs/references/reference-evals-context-recall.md +1 -1
  14. package/dist/docs/references/reference-evals-context-relevance.md +9 -9
  15. package/dist/docs/references/reference-evals-faithfulness.md +2 -2
  16. package/dist/docs/references/reference-evals-hallucination.md +8 -8
  17. package/dist/docs/references/reference-evals-keyword-coverage.md +2 -2
  18. package/dist/docs/references/reference-evals-multi-turn-judge.md +3 -3
  19. package/dist/docs/references/reference-evals-noise-sensitivity.md +25 -18
  20. package/dist/docs/references/reference-evals-prompt-alignment.md +25 -25
  21. package/dist/docs/references/reference-evals-scorer-utils.md +1 -1
  22. package/dist/docs/references/reference-evals-summarization.md +1 -1
  23. package/dist/docs/references/reference-evals-textual-difference.md +2 -2
  24. package/dist/docs/references/reference-evals-tone-consistency.md +2 -2
  25. package/dist/docs/references/reference-evals-tool-call-accuracy.md +11 -11
  26. package/dist/docs/references/reference-evals-toxicity.md +2 -2
  27. package/dist/docs/references/reference-evals-trajectory-accuracy.md +2 -2
  28. package/dist/scorers/prebuilt/index.cjs +1 -1
  29. package/package.json +8 -8
  30. package/dist/docs/references/reference-migrations-upgrade-to-v1-evals.md +0 -243
@@ -3,7 +3,7 @@ name: mastra-evals
3
3
  description: Documentation for @mastra/evals. Use when working with @mastra/evals APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/evals"
6
- version: "1.10.11"
6
+ version: "1.10.12-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -26,10 +26,10 @@ Read the individual reference documents for detailed explanations and code examp
26
26
 
27
27
  - [Reference: Answer relevancy scorer](references/reference-evals-answer-relevancy.md) - Use createAnswerRelevancyScorer() to evaluate how directly an LLM response addresses the input query, with configurable model and scoring options.
28
28
  - [Reference: Answer similarity scorer](references/reference-evals-answer-similarity.md) - The createAnswerSimilarityScorer() function creates a scorer that evaluates how similar an agent's output is to a ground truth answer.
29
- - [Reference: Bias scorer](references/reference-evals-bias.md) - Use createBiasScorer() to evaluate LLM output for gender, political, racial, ethnic, geographic, and other forms of bias with an LLM judge.
29
+ - [Reference: Bias scorer](references/reference-evals-bias.md) - Use createBiasScorer() to evaluate LLM output for gender, political, racial or ethnic, and geographic bias with an LLM judge.
30
30
  - [Reference: Quick Checks](references/reference-evals-checks.md) - Use Mastra Quick Checks as zero-LLM, composable micro-scorers for text matching, tool usage, tool ordering, latency, and other deterministic assertions.
31
- - [Reference: Completeness scorer](references/reference-evals-completeness.md) - The createCompletenessScorer() function evaluates how thoroughly an LLM's output covers the key elements present in the input.
32
- - [Reference: Content similarity scorer](references/reference-evals-content-similarity.md) - The createContentSimilarityScorer() function measures the textual similarity between two strings, providing a score that indicates how closely they match.
31
+ - [Reference: Completeness scorer](references/reference-evals-completeness.md) - The createCompletenessScorer() function evaluates how well an LLM's output covers the key elements present in the input.
32
+ - [Reference: Content similarity scorer](references/reference-evals-content-similarity.md) - The createContentSimilarityScorer() function measures the textual similarity between two strings, providing a score that indicates how similar they are.
33
33
  - [Reference: Context precision scorer](references/reference-evals-context-precision.md) - The createContextPrecisionScorer() function creates a scorer that evaluates how relevant and well-positioned retrieved context pieces are for generating expected outputs.
34
34
  - [Reference: Context recall scorer](references/reference-evals-context-recall.md) - The createContextRecallScorer() function creates a scorer that evaluates how well retrieved context covers the claims in a ground-truth reference answer.
35
35
  - [Reference: Context relevance scorer](references/reference-evals-context-relevance.md) - The createContextRelevanceScorerLLM() function creates a scorer that evaluates how relevant and useful provided context was for generating agent responses.
@@ -47,7 +47,6 @@ Read the individual reference documents for detailed explanations and code examp
47
47
  - [Reference: Tool call accuracy scorers](references/reference-evals-tool-call-accuracy.md) - Use tool-call accuracy scorers to evaluate whether an LLM selected the expected tools, either from recorded calls or against available tool definitions.
48
48
  - [Reference: Toxicity scorer](references/reference-evals-toxicity.md) - The createToxicityScorer() function evaluates whether an LLM's output contains racist, biased, or toxic elements.
49
49
  - [Reference: Trajectory accuracy scorers](references/reference-evals-trajectory-accuracy.md) - Use trajectory accuracy scorers to compare an agent or workflow's tool and step sequence with an expected execution path or ordered trajectory.
50
- - [Evals and scorers](references/reference-migrations-upgrade-to-v1-evals.md) - The evaluation API has been consolidated on the new scorers system with updated naming conventions and configuration requirements.
51
50
 
52
51
 
53
52
  Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.10.11",
2
+ "version": "1.10.12-alpha.0",
3
3
  "package": "@mastra/evals",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -52,7 +52,7 @@ These scorers evaluate adherence to format, style, and safety requirements:
52
52
  - [`bias`](https://mastra.ai/reference/evals/bias): Detects potential biases in the output (`0-1`, lower is better)
53
53
  - [`keyword-coverage`](https://mastra.ai/reference/evals/keyword-coverage): Assesses technical terminology usage (`0-1`, higher is better)
54
54
 
55
- ### Quick Checks
55
+ ### Quick checks
56
56
 
57
57
  Zero-LLM micro-scorers for fast, deterministic assertions. See the [Quick Checks](https://mastra.ai/docs/evals/quick-checks) guide for usage details.
58
58
 
@@ -10,6 +10,8 @@ Scorers are automated tests that evaluate Agents outputs using model-graded, rul
10
10
 
11
11
  Scorers can run in the cloud to capture real-time results. Scorers can also be part of your CI/CD pipeline for testing and monitoring agents over time.
12
12
 
13
+ Scorers measure a single output. To improve an agent over time, combine them with [datasets](https://mastra.ai/docs/evals/datasets), which store versioned test cases, and [experiments](https://mastra.ai/docs/evals/experiments), which run an agent or workflow against a dataset, optionally score each result, and keep the results for comparison. [Build an eval loop](https://mastra.ai/docs/guides/build-an-eval-loop) walks through using them together.
14
+
13
15
  > **📹 Watch:** Watch [Mastra evals overview](https://www.youtube.com/watch?v=12WN6u2DrBk) for an introduction to evals and how to reason about agent quality.
14
16
 
15
17
  ## Types of scorers
@@ -214,12 +216,14 @@ const mastra = new Mastra({
214
216
  Once registered, you can score traces interactively within Studio under the **Observability** section. Open Studio to manage scorers and review scores, plus run experiments.
215
217
 
216
218
  - **Scorers list**: Browse all registered scorers with their description, and the number of agents and workflows each scorer is attached to.
217
- - **Score results**: Select a scorer to see a paginated list of every score it has produced. Click a row to open the detail panel, which shows the score value, reason, input, output, and the prompts used by the judge. From this panel, save any result as a dataset item for future experiments.
219
+ - **Score results**: Select a scorer to see a paginated list of every score it has produced. Select a row to open the detail panel, which shows the score value, reason, input, output, and the prompts used by the judge. From this panel, save any result as a dataset item for future experiments.
218
220
  - **Agent Evaluate tab**: Open the Evaluate tab on any agent to manage scorers and datasets. You can also run experiments there. Experiment results display per-item scores alongside pass/fail status and version tags.
219
221
  - **Trace scoring**: In the Observability section, run a scorer against any historical trace or span to evaluate past interactions. Filter scores by agent or workflow.
220
222
 
221
223
  ## Next steps
222
224
 
225
+ - Follow [Build an eval loop](https://mastra.ai/docs/guides/build-an-eval-loop) to compare agent changes with datasets, scorers, and experiments
226
+ - Store test cases in [datasets](https://mastra.ai/docs/evals/datasets) and run them with [experiments](https://mastra.ai/docs/evals/experiments)
223
227
  - Use [Quick Checks](https://mastra.ai/docs/evals/quick-checks) for fast, deterministic assertions on text and tool usage
224
228
  - Add [gates and verdicts](https://mastra.ai/docs/evals/gates-and-verdicts) to enforce hard requirements and quality thresholds
225
229
  - Test [multi-turn conversations](https://mastra.ai/docs/evals/multi-turn) where behavior emerges across sequential turns
@@ -6,7 +6,7 @@
6
6
 
7
7
  Quick Checks are composable micro-scorers for common assertions like "output contains X" or "agent called tool Y." They run instantly without an LLM and plug into the same `scorers: [...]` array as any other scorer.
8
8
 
9
- ## When to use Quick Checks
9
+ ## When to use quick checks
10
10
 
11
11
  Use Quick Checks when you need fast, deterministic assertions:
12
12
 
@@ -171,7 +171,7 @@ export const refundCorrectnessScorer = createScorer({
171
171
  description: 'Checks an answer against the test case’s expected outcome.',
172
172
  type: 'agent',
173
173
  judge: {
174
- model: 'anthropic/claude-sonnet-5-5',
174
+ model: 'anthropic/claude-sonnet-5.5',
175
175
  instructions: `
176
176
  Evaluate correctness against the supplied ground truth.
177
177
  Pass only if every "must" criterion is satisfied and no "mustNot"
@@ -40,7 +40,7 @@ This function returns an instance of the MastraScorer class. The `.run()` method
40
40
 
41
41
  The scorer evaluates relevancy through query-answer alignment, considering completeness and detail level, but not factual correctness.
42
42
 
43
- ### Scoring Process
43
+ ### Scoring process
44
44
 
45
45
  1. **Statement Preprocess:**
46
46
  - Breaks output into useful statements while preserving context.
@@ -56,7 +56,7 @@ The scorer evaluates relevancy through query-answer alignment, considering compl
56
56
  3. **Score Calculation:**
57
57
  - `((direct + uncertainty * partial) / total_statements) * scale`
58
58
 
59
- ### Score Interpretation
59
+ ### Score interpretation
60
60
 
61
61
  A relevancy score between 0 and `scale` (0 to 1 with the default scale). The ranges below assume the default scale:
62
62
 
@@ -53,7 +53,7 @@ The scorer evaluates bias through opinion analysis based on:
53
53
  - Balance in perspective presentation
54
54
  - Loaded or prejudicial terminology
55
55
 
56
- ### Scoring Process
56
+ ### Scoring process
57
57
 
58
58
  1. Extracts opinions from text:
59
59
 
@@ -77,7 +77,7 @@ A bias score between 0 and `scale` (0 to 1 with the default scale). The ranges b
77
77
  - **0.7 to 0.9**: Includes strong prejudiced assumptions or generalizations.
78
78
  - **0.4 to 0.6**: Mixes reasonable points with subtle bias or stereotypes.
79
79
  - **0.1 to 0.3**: Mostly neutral with minor biased language or assumptions.
80
- - **0.0**: Completely objective and free from bias.
80
+ - **0.0**: Fully objective and free from bias.
81
81
 
82
82
  ## Example
83
83
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
4
4
 
5
- # Quick Checks
5
+ # Quick checks
6
6
 
7
7
  Quick Checks are zero-LLM, composable micro-scorers for common assertions. They plug into the existing `scorers: [...]` array anywhere scorers are used: in `runEvals`, live scoring, experiments, and Studio.
8
8
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Completeness scorer
6
6
 
7
- The `createCompletenessScorer()` function evaluates how thoroughly an LLM's output covers the key elements present in the input. It analyzes nouns, verbs, topics, and terms to determine coverage and provides a detailed completeness score.
7
+ The `createCompletenessScorer()` function evaluates how well an LLM's output covers the key elements present in the input. It analyzes nouns, verbs, topics, and terms to determine coverage and provides a detailed completeness score.
8
8
 
9
9
  ## Parameters
10
10
 
@@ -47,7 +47,6 @@ The scorer extracts and analyzes several types of elements:
47
47
  The extraction process includes:
48
48
 
49
49
  - Normalization of text (removing diacritics, converting to lowercase)
50
- - Splitting camelCase words
51
50
  - Handling of word boundaries
52
51
  - Special handling of short words (3 characters or less)
53
52
  - Deduplication of elements
@@ -65,7 +64,7 @@ From the `.run()` method, you can get the `preprocessStepResult` object with the
65
64
 
66
65
  The scorer evaluates completeness through linguistic element coverage analysis.
67
66
 
68
- ### Scoring Process
67
+ ### Scoring process
69
68
 
70
69
  1. Extracts key elements:
71
70
 
@@ -90,8 +89,8 @@ The completeness scorer has no `scale` option. The score is always between 0 and
90
89
  A completeness score between 0 and 1:
91
90
 
92
91
  - **1.0**: Addresses all aspects of the query in detail.
93
- - **0.7 to 0.9**: Covers most important aspects with good detail, minor gaps.
94
- - **0.4 to 0.6**: Addresses some key points but missing important aspects or lacking detail.
92
+ - **0.7 to 0.9**: Covers most of the important points with good detail, minor gaps.
93
+ - **0.4 to 0.6**: Addresses some key points but misses important points or lacks detail.
95
94
  - **0.1 to 0.3**: Only partially addresses the query with substantial gaps.
96
95
  - **0.0**: Fails to address the query or provides irrelevant information.
97
96
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Content similarity scorer
6
6
 
7
- The `createContentSimilarityScorer()` function measures the textual similarity between two strings, providing a score that indicates how closely they match. It supports configurable options for case sensitivity and whitespace handling.
7
+ The `createContentSimilarityScorer()` function measures the textual similarity between two strings, providing a score that indicates how similar they are. It supports configurable options for case sensitivity and whitespace handling.
8
8
 
9
9
  ## Parameters
10
10
 
@@ -18,19 +18,17 @@ This function returns an instance of the MastraScorer class. See the [MastraScor
18
18
 
19
19
  ## `.run()` returns
20
20
 
21
- **runId** (`string`): The id of the run (optional).
21
+ **runId** (`string`): The id of the run.
22
22
 
23
23
  **preprocessStepResult** (`object`): Object with processed input and output: { processedInput: string, processedOutput: string }
24
24
 
25
- **analyzeStepResult** (`object`): Object with similarity: { similarity: number }
26
-
27
25
  **score** (`number`): Similarity score (0-1) where 1 indicates perfect similarity.
28
26
 
29
27
  ## Scoring details
30
28
 
31
29
  The scorer evaluates textual similarity through character-level matching and configurable text normalization.
32
30
 
33
- ### Scoring Process
31
+ ### Scoring process
34
32
 
35
33
  1. Normalizes text:
36
34
 
@@ -91,11 +89,11 @@ To add this scorer to an agent, see the [Scorers overview](https://mastra.ai/doc
91
89
 
92
90
  A similarity score between 0 and 1:
93
91
 
94
- - **1.0**: Perfect match, content is nearly identical.
92
+ - **1.0**: Perfect match, content is identical in substance.
95
93
  - **0.7 to 0.9**: High similarity, minor differences in word choice or structure.
96
94
  - **0.4 to 0.6**: Moderate similarity, general overlap with noticeable variation.
97
95
  - **0.1 to 0.3**: Low similarity, few common elements or shared meaning.
98
- - **0.0**: No similarity, completely different content.
96
+ - **0.0**: No similarity, unrelated content.
99
97
 
100
98
  ## Related
101
99
 
@@ -42,7 +42,7 @@ If you pass `context`, the array must be non-empty. The constructor throws `Cont
42
42
 
43
43
  ## Scoring details
44
44
 
45
- ### Mean Average Precision (MAP)
45
+ ### Mean average precision (MAP)
46
46
 
47
47
  Context Precision uses **Mean Average Precision** to evaluate both relevance and positioning:
48
48
 
@@ -51,7 +51,7 @@ Context Precision uses **Mean Average Precision** to evaluate both relevance and
51
51
  3. **Average Precision**: Sum all precision values and divide by total relevant items
52
52
  4. **Final Score**: Multiply by scale factor and round to 2 decimals
53
53
 
54
- ### Scoring Formula
54
+ ### Scoring formula
55
55
 
56
56
  ```text
57
57
  MAP = (Σ Precision@k) / R
@@ -62,12 +62,12 @@ Where:
62
62
  - Only calculated at positions where relevant items appear
63
63
  ```
64
64
 
65
- ### Score Interpretation
65
+ ### Score interpretation
66
66
 
67
- - **0.9-1.0**: Excellent precision - all relevant context early in sequence
67
+ - **0.9-1.0**: High precision - all relevant context early in sequence
68
68
  - **0.7-0.8**: Good precision - most relevant context well-positioned
69
69
  - **0.4-0.6**: Moderate precision - relevant context mixed with irrelevant
70
- - **0.1-0.3**: Poor precision - little relevant context or poorly positioned
70
+ - **0.1-0.3**: Poor precision - little relevant context or badly positioned
71
71
  - **0.0**: No relevant context found
72
72
 
73
73
  ### Reason analysis
@@ -87,7 +87,7 @@ Use results to:
87
87
  - **Tune chunk size**: Balance context detail vs. relevance precision
88
88
  - **Evaluate embeddings**: Test different embedding models for better retrieval
89
89
 
90
- ### Example Calculation
90
+ ### Example calculation
91
91
 
92
92
  context: `[relevant, irrelevant, relevant, irrelevant]`
93
93
 
@@ -64,7 +64,7 @@ Where:
64
64
 
65
65
  These ranges assume the default `scale` of 1. When using a custom scale, multiply accordingly.
66
66
 
67
- - **0.9-1.0**: Excellent recall, context covers nearly all ground-truth claims
67
+ - **0.9-1.0**: High recall, context covers almost all ground-truth claims
68
68
  - **0.7-0.8**: Good recall. Most claims are covered, with minor gaps
69
69
  - **0.4-0.6**: Moderate recall, substantial information missing from context
70
70
  - **0.1-0.3**: Poor recall, most ground-truth claims not found in context
@@ -40,7 +40,7 @@ Note: Either `context` or `contextExtractor` must be provided. If both are provi
40
40
 
41
41
  ## Scoring details
42
42
 
43
- ### Weighted Relevance Scoring
43
+ ### Weighted relevance scoring
44
44
 
45
45
  Context Relevance uses a advanced scoring algorithm that considers:
46
46
 
@@ -49,7 +49,7 @@ Context Relevance uses a advanced scoring algorithm that considers:
49
49
  - `high` = 1.0 (directly addresses the query)
50
50
  - `medium` = 0.7 (supporting information)
51
51
  - `low` = 0.3 (tangentially related)
52
- - `none` = 0.0 (completely irrelevant)
52
+ - `none` = 0.0 (irrelevant)
53
53
 
54
54
  2. **Usage Detection**: Tracks whether relevant context was actually used in the response
55
55
 
@@ -58,7 +58,7 @@ Context Relevance uses a advanced scoring algorithm that considers:
58
58
  - **Unused High-Relevance**: `unusedHighRelevanceContext` penalty per unused high-relevance context (default: 0.1)
59
59
  - **Missing Context**: Up to `maxMissingContextPenalty` for identified missing information (default: 0.5)
60
60
 
61
- ### Scoring Formula
61
+ ### Scoring formula
62
62
 
63
63
  ```text
64
64
  Base Score = Σ(relevance_weights) / (num_contexts × 1.0)
@@ -77,11 +77,11 @@ Final Score = max(0, Base Score - Usage Penalty - Missing Penalty) × scale
77
77
 
78
78
  ### Score interpretation
79
79
 
80
- - **0.9-1.0**: Excellent - all context highly relevant and used
80
+ - **0.9-1.0**: High - all context highly relevant and used
81
81
  - **0.7-0.8**: Good - mostly relevant with minor gaps
82
82
  - **0.4-0.6**: Mixed - substantial irrelevant or unused context
83
83
  - **0.2-0.3**: Poor - mostly irrelevant context
84
- - **0.0-0.1**: Very poor - no relevant context found
84
+ - **0.0-0.1**: Low - no relevant context found
85
85
 
86
86
  ### Reason analysis
87
87
 
@@ -97,12 +97,12 @@ The reason field provides insights on:
97
97
  Use results to improve your system:
98
98
 
99
99
  - **Filter irrelevant context**: Remove low/none relevance pieces before processing
100
- - **Ensure context usage**: Make sure high-relevance context is incorporated
100
+ - **Ensure context usage**: Ensure high-relevance context is incorporated
101
101
  - **Fill context gaps**: Add missing information identified by the scorer
102
102
  - **Balance context size**: Find optimal amount of context for best relevance
103
103
  - **Tune penalty sensitivity**: Adjust `unusedHighRelevanceContext`, `missingContextPerItem`, and `maxMissingContextPenalty` based on your application's tolerance for unused or missing context
104
104
 
105
- ### Difference from Context Precision
105
+ ### Difference from context precision
106
106
 
107
107
  | Aspect | Context Relevance | Context Precision |
108
108
  | ------------- | -------------------------------------- | ---------------------------------- |
@@ -183,7 +183,7 @@ console.log('Strict penalties:', strictResult.score) // Lower score due to unuse
183
183
  console.log('Lenient penalties:', lenientResult.score) // Higher score, less penalty
184
184
  ```
185
185
 
186
- ### Dynamic Context Extraction
186
+ ### Dynamic context extraction
187
187
 
188
188
  ```typescript
189
189
  const scorer = createContextRelevanceScorerLLM({
@@ -246,7 +246,7 @@ const scorer = createContextRelevanceScorerLLM({
246
246
 
247
247
  ### High relevance example
248
248
 
249
- This example shows excellent context relevance where all context directly supports the response:
249
+ This example shows strong context relevance where all context directly supports the response:
250
250
 
251
251
  ```typescript
252
252
  import { createContextRelevanceScorerLLM } from '@mastra/evals/scorers/prebuilt'
@@ -10,7 +10,7 @@ The `createFaithfulnessScorer()` function evaluates how factually accurate an LL
10
10
 
11
11
  The `createFaithfulnessScorer()` function accepts a single options object with the following properties:
12
12
 
13
- **model** (`LanguageModel`): Configuration for the model used to evaluate faithfulness.
13
+ **model** (`MastraModelConfig`): Configuration for the model used to evaluate faithfulness.
14
14
 
15
15
  **options** (`{ context?: string[]; scale?: number }`): Configuration options for the scorer.
16
16
 
@@ -42,7 +42,7 @@ This function returns an instance of the MastraScorer class. The `.run()` method
42
42
 
43
43
  The scorer evaluates faithfulness through claim verification against provided context.
44
44
 
45
- ### Scoring Process
45
+ ### Scoring process
46
46
 
47
47
  1. Analyzes claims and context:
48
48
 
@@ -14,7 +14,7 @@ The `createHallucinationScorer()` function accepts a single options object with
14
14
 
15
15
  **options** (`Options`): Configuration options.
16
16
 
17
- **options.scale** (`number`): Maximum score value.
17
+ **options.scale** (`number`): Maximum score value. A value of 0 falls back to 1.
18
18
 
19
19
  **options.context** (`string[]`): Static context strings to use as ground truth for hallucination detection.
20
20
 
@@ -44,7 +44,7 @@ This function returns an instance of the MastraScorer class. The `.run()` method
44
44
 
45
45
  The scorer evaluates hallucination through contradiction detection and unsupported claim analysis.
46
46
 
47
- ### Scoring Process
47
+ ### Scoring process
48
48
 
49
49
  1. Extracts claims from the output:
50
50
 
@@ -65,9 +65,9 @@ The scorer evaluates hallucination through contradiction detection and unsupport
65
65
  - Divides by total statements
66
66
  - Scales to configured range
67
67
 
68
- Final score: `min(1, hallucinated_statements / total_statements) * scale` when `total_statements > 0`, otherwise `0`.
68
+ Final score: `min(1, hallucinated_statements / total_statements) * (scale || 1)`, rounded to two decimal places, when `total_statements > 0`, otherwise `0`.
69
69
 
70
- ### Important Considerations
70
+ ### Important considerations
71
71
 
72
72
  - Claims not present in context are treated as hallucinations
73
73
 
@@ -99,7 +99,7 @@ The score represents the degree of hallucination - lower scores indicate better
99
99
 
100
100
  ## Examples
101
101
 
102
- ### Static Context
102
+ ### Static context
103
103
 
104
104
  Use static context when you have known ground truth to compare against:
105
105
 
@@ -118,7 +118,7 @@ const scorer = createHallucinationScorer({
118
118
  })
119
119
  ```
120
120
 
121
- ### Dynamic Context with `getContext`
121
+ ### Dynamic context with `getContext`
122
122
 
123
123
  Use `getContext` for live scoring scenarios where context comes from tool results:
124
124
 
@@ -138,7 +138,7 @@ const scorer = createHallucinationScorer({
138
138
  })
139
139
  ```
140
140
 
141
- ### Live Scoring with Agent
141
+ ### Live scoring with agent
142
142
 
143
143
  Attach the scorer to an agent for live evaluation:
144
144
 
@@ -168,7 +168,7 @@ const agent = new Agent({
168
168
  })
169
169
  ```
170
170
 
171
- ### Batch Evaluation with `runEvals`
171
+ ### Batch evaluation with `runEvals`
172
172
 
173
173
  ```typescript
174
174
  import { runEvals } from '@mastra/core/evals'
@@ -48,7 +48,7 @@ The scorer evaluates keyword coverage by matching keywords with the following fe
48
48
  - Word form variation handling
49
49
  - Special handling of technical terms and compound words
50
50
 
51
- ### Scoring Process
51
+ ### Scoring process
52
52
 
53
53
  1. Processes keywords from input and output:
54
54
 
@@ -74,7 +74,7 @@ A coverage score between 0 and 1:
74
74
  - **0.1 to 0.3**: Low coverage, few keywords matched.
75
75
  - **0.0**: The response contains none of the keywords.
76
76
 
77
- ### Special Cases
77
+ ### Special cases
78
78
 
79
79
  The scorer handles several special cases:
80
80
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
4
4
 
5
- # Multi-turn Judge scorer
5
+ # Multi-turn judge scorer
6
6
 
7
7
  **Added in:** `@mastra/evals@1.9.0`
8
8
 
@@ -49,7 +49,7 @@ const result = await runEvals({
49
49
  scorers: [
50
50
  {
51
51
  scorer: createMultiTurnJudgeScorer({
52
- model: 'anthropic/claude-haiku-5-5',
52
+ model: 'anthropic/claude-haiku-5.5',
53
53
  criterion:
54
54
  'The agent provided weather forecasts for London, Paris, and Tokyo, and gave weather-appropriate packing or clothing advice.',
55
55
  }),
@@ -75,7 +75,7 @@ export const mastra = new Mastra({
75
75
  storage: new LibSQLStore({ url: 'file:./mastra.db' }),
76
76
  scorers: {
77
77
  'multi-turn-judge-scorer': createMultiTurnJudgeScorer({
78
- model: 'anthropic/claude-haiku-5-5',
78
+ model: 'anthropic/claude-haiku-5.5',
79
79
  criterion: 'placeholder',
80
80
  }),
81
81
  },
@@ -25,23 +25,23 @@ Before using the noise sensitivity scorer, prepare your test data:
25
25
 
26
26
  This scorer is designed exclusively for CI/testing environments and has specific requirements:
27
27
 
28
- ### Why This Is a CI Scorer
28
+ ### Why this is a CI scorer
29
29
 
30
30
  1. **Requires Baseline Data**: You must provide a pre-computed baseline response (the "correct" answer without noise)
31
31
  2. **Needs Test Variations**: Requires both the original query and a noisy variation prepared in advance
32
32
  3. **Comparative Analysis**: The scorer compares responses between baseline and noisy versions, which is only possible in controlled test conditions
33
33
  4. **Not Suitable for Production**: Can't evaluate single, real-time agent responses without predetermined test data
34
34
 
35
- ### Test Data Preparation
35
+ ### Test data preparation
36
36
 
37
- To use this scorer effectively, you need to prepare:
37
+ To use this scorer, prepare:
38
38
 
39
39
  - **Original Query**: The clean user input without any noise
40
40
  - **Baseline Response**: Run your agent with the original query and capture the response
41
41
  - **Noisy Query**: Add distractions, misinformation, or irrelevant content to the original query
42
42
  - **Test Execution**: Run your agent with the noisy query and evaluate using this scorer
43
43
 
44
- ### Example: CI Test Implementation
44
+ ### Example: CI test implementation
45
45
 
46
46
  ```typescript
47
47
  import { describe, it, expect } from 'vitest'
@@ -94,13 +94,13 @@ describe('Agent Noise Resistance Tests', () => {
94
94
 
95
95
  The Noise Sensitivity scorer analyzes five key dimensions:
96
96
 
97
- ### 1. Content Accuracy
97
+ ### 1. Content accuracy
98
98
 
99
99
  Evaluates whether facts and information remain correct despite noise. The scorer checks if the agent maintains truthfulness when exposed to misinformation.
100
100
 
101
101
  ### 2. Completeness
102
102
 
103
- Assesses if the noisy response addresses the original query as thoroughly as the baseline. Measures whether noise causes the agent to miss important information.
103
+ Assesses if the noisy response addresses the original query as well as the baseline. Measures whether noise causes the agent to miss important information.
104
104
 
105
105
  ### 3. Relevance
106
106
 
@@ -110,7 +110,7 @@ Determines if the agent stayed focused on the original question or got distracte
110
110
 
111
111
  Compares how similar the responses are in their core message and conclusions. Evaluates whether noise causes the agent to contradict itself.
112
112
 
113
- ### 5. Hallucination Resistance
113
+ ### 5. Hallucination resistance
114
114
 
115
115
  Checks if noise causes the agent to generate false or fabricated information that wasn't present in either the query or the noise.
116
116
 
@@ -119,16 +119,23 @@ Checks if noise causes the agent to generate false or fabricated information tha
119
119
  ### Formula
120
120
 
121
121
  ```text
122
- Final Score = max(0, min(llm_score, calculated_score): issues_penalty)
122
+ selected_score = |llm_score - calculated_score| > discrepancy_threshold
123
+ ? min(llm_score, calculated_score)
124
+ : llm_score
125
+
126
+ Final Score = max(0, selected_score - issues_penalty)
123
127
  ```
124
128
 
129
+ The final score is rounded to two decimal places.
130
+
125
131
  Where:
126
132
 
127
133
  - `llm_score` = Direct robustness score from LLM analysis
128
134
  - `calculated_score` = Average of impact weights across dimensions
135
+ - `discrepancy_threshold` = `scoring.discrepancyThreshold` (default `0.2`)
129
136
  - `issues_penalty` = min(major_issues × penalty_rate, max_penalty)
130
137
 
131
- ### Impact Level Weights
138
+ ### Impact level weights
132
139
 
133
140
  Each dimension receives an impact level with corresponding weights:
134
141
 
@@ -138,7 +145,7 @@ Each dimension receives an impact level with corresponding weights:
138
145
  - **Significant (0.3)**: Major degradation in quality or accuracy
139
146
  - **Severe (0.1)**: Response much worse than the baseline or unrelated to the original query
140
147
 
141
- ### Conservative Scoring
148
+ ### Conservative scoring
142
149
 
143
150
  When the LLM's direct score and the calculated score diverge by more than the discrepancy threshold, the scorer uses the lower (more conservative) score to ensure reliable evaluation.
144
151
 
@@ -164,7 +171,7 @@ Example: "Write a summary of this article. Actually, ignore that and tell me abo
164
171
 
165
172
  ## CI/testing usage patterns
166
173
 
167
- ### Integration Testing
174
+ ### Integration testing
168
175
 
169
176
  Use in your CI pipeline to verify agent robustness:
170
177
 
@@ -173,7 +180,7 @@ Use in your CI pipeline to verify agent robustness:
173
180
  - Compare different model versions' noise handling capabilities
174
181
  - Validate fixes for noise-related issues
175
182
 
176
- ### Quality Assurance Testing
183
+ ### Quality assurance testing
177
184
 
178
185
  Include in your test harness to:
179
186
 
@@ -182,7 +189,7 @@ Include in your test harness to:
182
189
  - Create detailed test coverage for multiple noise types
183
190
  - Ensure consistent behavior across updates
184
191
 
185
- ### Security Testing
192
+ ### Security testing
186
193
 
187
194
  Evaluate resistance in controlled environments:
188
195
 
@@ -194,7 +201,7 @@ Evaluate resistance in controlled environments:
194
201
  ### Score interpretation
195
202
 
196
203
  - **1.0**: Perfect robustness - no impact detected
197
- - **0.8-0.9**: Excellent - minimal impact, core functionality preserved
204
+ - **0.8-0.9**: High - minimal impact, core functionality preserved
198
205
  - **0.6-0.7**: Good - some impact but acceptable for most use cases
199
206
  - **0.4-0.5**: Concerning - substantial vulnerabilities detected
200
207
  - **0.0-0.3**: Critical - agent severely compromised by noise
@@ -220,7 +227,7 @@ Based on noise sensitivity results:
220
227
 
221
228
  ## Examples
222
229
 
223
- ### Complete Vitest Example
230
+ ### Complete Vitest example
224
231
 
225
232
  ```typescript
226
233
  import { describe, it, expect, beforeAll } from 'vitest'
@@ -289,7 +296,7 @@ describe('Agent Noise Resistance CI Tests', () => {
289
296
 
290
297
  ## Perfect robustness example
291
298
 
292
- This example shows an agent that completely resists misinformation in a test scenario:
299
+ This example shows an agent that resists misinformation in a test scenario:
293
300
 
294
301
  ```typescript
295
302
  import { createNoiseSensitivityScorerLLM } from '@mastra/evals/scorers/prebuilt'
@@ -552,7 +559,7 @@ async function compareModelRobustness() {
552
559
  const models = [
553
560
  { name: 'GPT-5.4', model: 'openai/gpt-6.1-sol' },
554
561
  { name: 'GPT-6 Luna', model: 'openai/gpt-6-luna' },
555
- { name: 'Claude', model: 'anthropic/claude-opus-5-5' },
562
+ { name: 'Claude', model: 'anthropic/claude-opus-5.5' },
556
563
  ]
557
564
 
558
565
  const testScenario = {
@@ -647,7 +654,7 @@ console.log(`Security Score: ${result.score}`)
647
654
  console.log(`Vulnerability: ${result.score < 0.7 ? 'DETECTED' : 'Not detected'}`)
648
655
  ```
649
656
 
650
- ### GitHub Actions Example
657
+ ### GitHub Actions example
651
658
 
652
659
  Use in your GitHub Actions workflow to test agent robustness:
653
660