@mastra/evals 1.10.12 → 1.10.13-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.
- package/dist/{checks-CVR2yDHg.cjs → checks-BGDit37J.cjs} +2 -2
- package/dist/{checks-DXG9awTJ.js → checks-D5UyczcW.js} +2 -2
- package/dist/checks.cjs +1 -1
- package/dist/checks.js +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{matchers-CVIJYGVp.js → matchers-BRqioXz6.js} +2 -2
- package/dist/{matchers-CL0xCK25.cjs → matchers-DzscWdy_.cjs} +2 -2
- package/dist/scorers/prebuilt/index.cjs +11 -11
- package/dist/scorers/prebuilt/index.js +11 -11
- package/dist/vitest/index.cjs +9 -9
- package/dist/vitest/index.js +9 -9
- package/dist/vitest/setup.cjs +1 -1
- package/dist/vitest/setup.js +1 -1
- package/package.json +3 -3
|
@@ -138,7 +138,7 @@ function matches(pattern, options = {}) {
|
|
|
138
138
|
type: "agent"
|
|
139
139
|
}).preprocess(async ({ run }) => {
|
|
140
140
|
const output = run.output.filter((m) => m.role === "assistant").map((m) => require_scorers_utils.getTextContentFromMastraDBMessage(m)).join("");
|
|
141
|
-
const regex = exact ? new RegExp(
|
|
141
|
+
const regex = exact ? new RegExp(`^(?:${pattern.source})$`, pattern.flags) : pattern;
|
|
142
142
|
regex.lastIndex = 0;
|
|
143
143
|
const matched = regex.test(output);
|
|
144
144
|
return {
|
|
@@ -257,7 +257,7 @@ function toolOrder(expectedOrder) {
|
|
|
257
257
|
return (0, _mastra_core_evals.createScorer)({
|
|
258
258
|
id: "check-tool-order",
|
|
259
259
|
name: "Tool Order Check",
|
|
260
|
-
description: `Checks tool call order: [${expectedOrder.join("
|
|
260
|
+
description: `Checks tool call order: [${expectedOrder.join(" \u2192 ")}]`,
|
|
261
261
|
type: "agent"
|
|
262
262
|
}).preprocess(async ({ run }) => {
|
|
263
263
|
const { tools } = require_scorers_utils.extractToolCalls(run.output);
|
|
@@ -116,7 +116,7 @@ function matches(pattern, options = {}) {
|
|
|
116
116
|
type: "agent"
|
|
117
117
|
}).preprocess(async ({ run }) => {
|
|
118
118
|
const output = run.output.filter((m) => m.role === "assistant").map((m) => getTextContentFromMastraDBMessage(m)).join("");
|
|
119
|
-
const regex = exact ? new RegExp(
|
|
119
|
+
const regex = exact ? new RegExp(`^(?:${pattern.source})$`, pattern.flags) : pattern;
|
|
120
120
|
regex.lastIndex = 0;
|
|
121
121
|
const matched = regex.test(output);
|
|
122
122
|
return {
|
|
@@ -235,7 +235,7 @@ function toolOrder(expectedOrder) {
|
|
|
235
235
|
return createScorer({
|
|
236
236
|
id: "check-tool-order",
|
|
237
237
|
name: "Tool Order Check",
|
|
238
|
-
description: `Checks tool call order: [${expectedOrder.join("
|
|
238
|
+
description: `Checks tool call order: [${expectedOrder.join(" \u2192 ")}]`,
|
|
239
239
|
type: "agent"
|
|
240
240
|
}).preprocess(async ({ run }) => {
|
|
241
241
|
const { tools } = extractToolCalls(run.output);
|
package/dist/checks.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_checks = require("./checks-
|
|
2
|
+
const require_checks = require("./checks-BGDit37J.cjs");
|
|
3
3
|
exports.calledTool = require_checks.calledTool;
|
|
4
4
|
exports.checks = require_checks.checks;
|
|
5
5
|
exports.didNotCall = require_checks.didNotCall;
|
package/dist/checks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as calledTool, n as checks, r as didNotCall, i as equals, a as excludes, o as includes, s as matches, c as maxToolCalls, l as noToolErrors, u as similarity, d as toolOrder, f as usedNoTools } from "./checks-
|
|
1
|
+
export { t as calledTool, n as checks, r as didNotCall, i as equals, a as excludes, o as includes, s as matches, c as maxToolCalls, l as noToolErrors, u as similarity, d as toolOrder, f as usedNoTools } from "./checks-D5UyczcW.js";
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -68,7 +68,7 @@ const evalMatchers = {
|
|
|
68
68
|
const failed = gates.filter((g) => !g.passed);
|
|
69
69
|
return {
|
|
70
70
|
pass: failed.length === 0,
|
|
71
|
-
message: () => failed.length === 0 ? `expected at least one gate to fail, but all ${gates.length} passed` : `expected all gates to pass, but ${failed.length} failed:\n${failed.map((g) => `
|
|
71
|
+
message: () => failed.length === 0 ? `expected at least one gate to fail, but all ${gates.length} passed` : `expected all gates to pass, but ${failed.length} failed:\n${failed.map((g) => ` \u2717 ${g.id} (score: ${g.score})`).join("\n")}`
|
|
72
72
|
};
|
|
73
73
|
},
|
|
74
74
|
toPassThresholds(received) {
|
|
@@ -84,7 +84,7 @@ const evalMatchers = {
|
|
|
84
84
|
const failed = thresholds.filter((t) => !t.passed);
|
|
85
85
|
return {
|
|
86
86
|
pass: failed.length === 0,
|
|
87
|
-
message: () => failed.length === 0 ? `expected at least one threshold to fail, but all ${thresholds.length} passed` : `expected all thresholds to pass, but ${failed.length} failed:\n${failed.map((t) => `
|
|
87
|
+
message: () => failed.length === 0 ? `expected at least one threshold to fail, but all ${thresholds.length} passed` : `expected all thresholds to pass, but ${failed.length} failed:\n${failed.map((t) => ` \u2717 ${t.id} (average score: ${t.averageScore}, threshold: ${JSON.stringify(t.threshold)})`).join("\n")}`
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
};
|
|
@@ -68,7 +68,7 @@ const evalMatchers = {
|
|
|
68
68
|
const failed = gates.filter((g) => !g.passed);
|
|
69
69
|
return {
|
|
70
70
|
pass: failed.length === 0,
|
|
71
|
-
message: () => failed.length === 0 ? `expected at least one gate to fail, but all ${gates.length} passed` : `expected all gates to pass, but ${failed.length} failed:\n${failed.map((g) => `
|
|
71
|
+
message: () => failed.length === 0 ? `expected at least one gate to fail, but all ${gates.length} passed` : `expected all gates to pass, but ${failed.length} failed:\n${failed.map((g) => ` \u2717 ${g.id} (score: ${g.score})`).join("\n")}`
|
|
72
72
|
};
|
|
73
73
|
},
|
|
74
74
|
toPassThresholds(received) {
|
|
@@ -84,7 +84,7 @@ const evalMatchers = {
|
|
|
84
84
|
const failed = thresholds.filter((t) => !t.passed);
|
|
85
85
|
return {
|
|
86
86
|
pass: failed.length === 0,
|
|
87
|
-
message: () => failed.length === 0 ? `expected at least one threshold to fail, but all ${thresholds.length} passed` : `expected all thresholds to pass, but ${failed.length} failed:\n${failed.map((t) => `
|
|
87
|
+
message: () => failed.length === 0 ? `expected at least one threshold to fail, but all ${thresholds.length} passed` : `expected all thresholds to pass, but ${failed.length} failed:\n${failed.map((t) => ` \u2717 ${t.id} (average score: ${t.averageScore}, threshold: ${JSON.stringify(t.threshold)})`).join("\n")}`
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_scorers_utils = require("../utils.cjs");
|
|
3
|
-
const require_checks = require("../../checks-
|
|
3
|
+
const require_checks = require("../../checks-BGDit37J.cjs");
|
|
4
4
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
5
5
|
let compromise = require("compromise");
|
|
6
6
|
compromise = require_checks.__toESM(compromise, 1);
|
|
@@ -835,7 +835,7 @@ The 'reason' is the reason for the result. When the result is 'yes', try to prov
|
|
|
835
835
|
|
|
836
836
|
**
|
|
837
837
|
IMPORTANT: Please make sure to only return in JSON format, with the 'results' key as a list of JSON objects.
|
|
838
|
-
Example Opinions: ["Government meddling in healthcare bloats costs and quashes innovation
|
|
838
|
+
Example Opinions: ["Government meddling in healthcare bloats costs and quashes innovation\u2014free markets are the answer.", "Different models of government involvement in healthcare aim to balance accessibility, cost, and quality, each with its own merits and challenges.", "I cannot answer this question."]
|
|
839
839
|
|
|
840
840
|
Example JSON:
|
|
841
841
|
{{
|
|
@@ -2121,7 +2121,7 @@ ${JSON.stringify(verdicts, null, 2)}
|
|
|
2121
2121
|
Context Recall measures what fraction of the ground-truth answer's claims are supported by the retrieved context. The score is calculated as:
|
|
2122
2122
|
- Extract all claims from the ground-truth answer
|
|
2123
2123
|
- Check each claim against the retrieval context
|
|
2124
|
-
- Score = (attributed claims / total claims)
|
|
2124
|
+
- Score = (attributed claims / total claims) \u00D7 scale
|
|
2125
2125
|
|
|
2126
2126
|
Rules for explanation:
|
|
2127
2127
|
- Explain which claims were and were not found in the context
|
|
@@ -2274,7 +2274,7 @@ Return your judgement as JSON in this shape:
|
|
|
2274
2274
|
* self-contained when it is logged or persisted alongside the score.
|
|
2275
2275
|
*/
|
|
2276
2276
|
function formatMultiTurnJudgeReason({ score, criterion, analysis }) {
|
|
2277
|
-
return `${analysis?.satisfied ?? score >= 1 ? "
|
|
2277
|
+
return `${analysis?.satisfied ?? score >= 1 ? "\u2705 Criterion satisfied." : "\u274C Criterion not satisfied."}\n\n${criterion}\n\n${analysis?.reasoning || "(no reasoning returned by the judge)"}`;
|
|
2278
2278
|
}
|
|
2279
2279
|
// src/scorers/llm/multi-turn-judge/index.ts
|
|
2280
2280
|
const analyzeOutputSchema$4 = {
|
|
@@ -2869,7 +2869,7 @@ Evaluation Breakdown:
|
|
|
2869
2869
|
|
|
2870
2870
|
- Requirements Fulfillment (30% weight): ${analysis.requirementsFulfillment.overallScore}
|
|
2871
2871
|
${fulfilledCount} out of ${totalRequirements} requirements met
|
|
2872
|
-
${analysis.requirementsFulfillment.requirements.map((r) =>
|
|
2872
|
+
${analysis.requirementsFulfillment.requirements.map((r) => `\u2022 ${r.requirement}: ${r.isFulfilled ? "\u2713" : "\u2717"}`).join("\n ")}
|
|
2873
2873
|
|
|
2874
2874
|
- Completeness (20% weight): ${analysis.completeness.score}
|
|
2875
2875
|
${analysis.completeness.missingElements.length > 0 ? `Missing elements: ${analysis.completeness.missingElements.join(", ")}` : "Response is complete"}
|
|
@@ -3121,9 +3121,9 @@ Return your judgement as JSON in this shape:
|
|
|
3121
3121
|
*/
|
|
3122
3122
|
function formatRubricReason({ score, analysis }) {
|
|
3123
3123
|
const complete = score >= 1;
|
|
3124
|
-
const header = complete ? "
|
|
3124
|
+
const header = complete ? "\u2705 Rubric satisfied: every required criterion is met." : "\u274C Rubric not yet satisfied.";
|
|
3125
3125
|
const lines = analysis.criteria.map((c) => {
|
|
3126
|
-
return `${c.satisfied ? "
|
|
3126
|
+
return `${c.satisfied ? "\u2705" : "\u274C"} [${c.required ? "required" : "optional"}] ${c.criterion}\n \u2192 ${c.reasoning}`;
|
|
3127
3127
|
});
|
|
3128
3128
|
const unmetRequired = analysis.criteria.filter((c) => c.required && !c.satisfied);
|
|
3129
3129
|
const footer = complete ? "" : `\n\nTo finish, address the ${unmetRequired.length} unmet required ${unmetRequired.length === 1 ? "criterion" : "criteria"} above.`;
|
|
@@ -3162,7 +3162,7 @@ const analyzeOutputSchema$1 = {
|
|
|
3162
3162
|
* with common list markers stripped from the front.
|
|
3163
3163
|
*/
|
|
3164
3164
|
function parseRubricString(rubric) {
|
|
3165
|
-
return rubric.split("\n").map((line) => line.replace(/^\s*(?:[
|
|
3165
|
+
return rubric.split("\n").map((line) => line.replace(/^\s*(?:[-*\u2022]|\d+[.)])\s*/, "").trim()).filter((line) => line.length > 0).map((description) => ({
|
|
3166
3166
|
description,
|
|
3167
3167
|
required: true
|
|
3168
3168
|
}));
|
|
@@ -3465,7 +3465,7 @@ ${missingQuestions.length > 0 ? missingQuestions.map((question) => `- ${question
|
|
|
3465
3465
|
Summarization takes the lower of two scores, so the weaker axis decides the result:
|
|
3466
3466
|
- Alignment = supported claims / total claims
|
|
3467
3467
|
- Coverage = answered questions / total questions
|
|
3468
|
-
- Score = min(alignment, coverage)
|
|
3468
|
+
- Score = min(alignment, coverage) \u00D7 scale
|
|
3469
3469
|
|
|
3470
3470
|
Rules for explanation:
|
|
3471
3471
|
- Name the axis that produced the score
|
|
@@ -4357,7 +4357,7 @@ function createTrajectoryAccuracyScorerCode(options = {}) {
|
|
|
4357
4357
|
const { ordering = "relaxed", allowRepeatedSteps = true } = comparisonOptions;
|
|
4358
4358
|
const staticExpectedSteps = Array.isArray(staticExpectedTrajectory) ? staticExpectedTrajectory : staticExpectedTrajectory?.steps.map(trajectoryStepToExpectedStep);
|
|
4359
4359
|
const getDescription = () => {
|
|
4360
|
-
if (staticExpectedSteps) return `Evaluates whether the trajectory matches the expected path: [${staticExpectedSteps.map((s) => s.name).join("
|
|
4360
|
+
if (staticExpectedSteps) return `Evaluates whether the trajectory matches the expected path: [${staticExpectedSteps.map((s) => s.name).join(" \u2192 ")}] (${ordering} ordering)`;
|
|
4361
4361
|
return `Evaluates trajectory accuracy against expected trajectory from dataset items (${ordering} ordering)`;
|
|
4362
4362
|
};
|
|
4363
4363
|
return (0, _mastra_core_evals.createScorer)({
|
|
@@ -4644,7 +4644,7 @@ function createTrajectoryScorerCode(options = {}) {
|
|
|
4644
4644
|
if (blacklist && blacklist.score === 0) {
|
|
4645
4645
|
const violations = [];
|
|
4646
4646
|
if (blacklist.violatedTools.length > 0) violations.push(`forbidden tools used: ${blacklist.violatedTools.join(", ")}`);
|
|
4647
|
-
if (blacklist.violatedSequences.length > 0) violations.push(`forbidden sequences: ${blacklist.violatedSequences.map((s) => s.join("
|
|
4647
|
+
if (blacklist.violatedSequences.length > 0) violations.push(`forbidden sequences: ${blacklist.violatedSequences.map((s) => s.join(" \u2192 ")).join("; ")}`);
|
|
4648
4648
|
parts.push(`Blacklist violation: ${violations.join(". ")}.`);
|
|
4649
4649
|
return parts.join("\n");
|
|
4650
4650
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { analyzeToolFailures, checkTrajectoryBlacklist, checkTrajectoryEfficiency, compareTrajectories, extractAgentResponseMessages, extractToolCalls, getAssistantMessageFromRunOutput, getCombinedSystemPrompt, getConversationHistoryFromRunInput, getTextContentFromMastraDBMessage, getUserMessageFromRunInput, isScorerRunInputForAgent, isScorerRunOutputForAgent, roundToTwoDecimals, toToolLevelSteps } from "../utils.js";
|
|
2
|
-
import { a as excludes, c as maxToolCalls, d as toolOrder, f as usedNoTools, i as equals, l as noToolErrors, n as checks, o as includes, r as didNotCall, s as matches, t as calledTool, u as similarity } from "../../checks-
|
|
2
|
+
import { a as excludes, c as maxToolCalls, d as toolOrder, f as usedNoTools, i as equals, l as noToolErrors, n as checks, o as includes, r as didNotCall, s as matches, t as calledTool, u as similarity } from "../../checks-D5UyczcW.js";
|
|
3
3
|
import { createScorer } from "@mastra/core/evals";
|
|
4
4
|
import nlp from "compromise";
|
|
5
5
|
import keyword_extractor from "keyword-extractor";
|
|
@@ -830,7 +830,7 @@ The 'reason' is the reason for the result. When the result is 'yes', try to prov
|
|
|
830
830
|
|
|
831
831
|
**
|
|
832
832
|
IMPORTANT: Please make sure to only return in JSON format, with the 'results' key as a list of JSON objects.
|
|
833
|
-
Example Opinions: ["Government meddling in healthcare bloats costs and quashes innovation
|
|
833
|
+
Example Opinions: ["Government meddling in healthcare bloats costs and quashes innovation\u2014free markets are the answer.", "Different models of government involvement in healthcare aim to balance accessibility, cost, and quality, each with its own merits and challenges.", "I cannot answer this question."]
|
|
834
834
|
|
|
835
835
|
Example JSON:
|
|
836
836
|
{{
|
|
@@ -2116,7 +2116,7 @@ ${JSON.stringify(verdicts, null, 2)}
|
|
|
2116
2116
|
Context Recall measures what fraction of the ground-truth answer's claims are supported by the retrieved context. The score is calculated as:
|
|
2117
2117
|
- Extract all claims from the ground-truth answer
|
|
2118
2118
|
- Check each claim against the retrieval context
|
|
2119
|
-
- Score = (attributed claims / total claims)
|
|
2119
|
+
- Score = (attributed claims / total claims) \u00D7 scale
|
|
2120
2120
|
|
|
2121
2121
|
Rules for explanation:
|
|
2122
2122
|
- Explain which claims were and were not found in the context
|
|
@@ -2269,7 +2269,7 @@ Return your judgement as JSON in this shape:
|
|
|
2269
2269
|
* self-contained when it is logged or persisted alongside the score.
|
|
2270
2270
|
*/
|
|
2271
2271
|
function formatMultiTurnJudgeReason({ score, criterion, analysis }) {
|
|
2272
|
-
return `${analysis?.satisfied ?? score >= 1 ? "
|
|
2272
|
+
return `${analysis?.satisfied ?? score >= 1 ? "\u2705 Criterion satisfied." : "\u274C Criterion not satisfied."}\n\n${criterion}\n\n${analysis?.reasoning || "(no reasoning returned by the judge)"}`;
|
|
2273
2273
|
}
|
|
2274
2274
|
// src/scorers/llm/multi-turn-judge/index.ts
|
|
2275
2275
|
const analyzeOutputSchema$4 = {
|
|
@@ -2864,7 +2864,7 @@ Evaluation Breakdown:
|
|
|
2864
2864
|
|
|
2865
2865
|
- Requirements Fulfillment (30% weight): ${analysis.requirementsFulfillment.overallScore}
|
|
2866
2866
|
${fulfilledCount} out of ${totalRequirements} requirements met
|
|
2867
|
-
${analysis.requirementsFulfillment.requirements.map((r) =>
|
|
2867
|
+
${analysis.requirementsFulfillment.requirements.map((r) => `\u2022 ${r.requirement}: ${r.isFulfilled ? "\u2713" : "\u2717"}`).join("\n ")}
|
|
2868
2868
|
|
|
2869
2869
|
- Completeness (20% weight): ${analysis.completeness.score}
|
|
2870
2870
|
${analysis.completeness.missingElements.length > 0 ? `Missing elements: ${analysis.completeness.missingElements.join(", ")}` : "Response is complete"}
|
|
@@ -3116,9 +3116,9 @@ Return your judgement as JSON in this shape:
|
|
|
3116
3116
|
*/
|
|
3117
3117
|
function formatRubricReason({ score, analysis }) {
|
|
3118
3118
|
const complete = score >= 1;
|
|
3119
|
-
const header = complete ? "
|
|
3119
|
+
const header = complete ? "\u2705 Rubric satisfied: every required criterion is met." : "\u274C Rubric not yet satisfied.";
|
|
3120
3120
|
const lines = analysis.criteria.map((c) => {
|
|
3121
|
-
return `${c.satisfied ? "
|
|
3121
|
+
return `${c.satisfied ? "\u2705" : "\u274C"} [${c.required ? "required" : "optional"}] ${c.criterion}\n \u2192 ${c.reasoning}`;
|
|
3122
3122
|
});
|
|
3123
3123
|
const unmetRequired = analysis.criteria.filter((c) => c.required && !c.satisfied);
|
|
3124
3124
|
const footer = complete ? "" : `\n\nTo finish, address the ${unmetRequired.length} unmet required ${unmetRequired.length === 1 ? "criterion" : "criteria"} above.`;
|
|
@@ -3157,7 +3157,7 @@ const analyzeOutputSchema$1 = {
|
|
|
3157
3157
|
* with common list markers stripped from the front.
|
|
3158
3158
|
*/
|
|
3159
3159
|
function parseRubricString(rubric) {
|
|
3160
|
-
return rubric.split("\n").map((line) => line.replace(/^\s*(?:[
|
|
3160
|
+
return rubric.split("\n").map((line) => line.replace(/^\s*(?:[-*\u2022]|\d+[.)])\s*/, "").trim()).filter((line) => line.length > 0).map((description) => ({
|
|
3161
3161
|
description,
|
|
3162
3162
|
required: true
|
|
3163
3163
|
}));
|
|
@@ -3460,7 +3460,7 @@ ${missingQuestions.length > 0 ? missingQuestions.map((question) => `- ${question
|
|
|
3460
3460
|
Summarization takes the lower of two scores, so the weaker axis decides the result:
|
|
3461
3461
|
- Alignment = supported claims / total claims
|
|
3462
3462
|
- Coverage = answered questions / total questions
|
|
3463
|
-
- Score = min(alignment, coverage)
|
|
3463
|
+
- Score = min(alignment, coverage) \u00D7 scale
|
|
3464
3464
|
|
|
3465
3465
|
Rules for explanation:
|
|
3466
3466
|
- Name the axis that produced the score
|
|
@@ -4352,7 +4352,7 @@ function createTrajectoryAccuracyScorerCode(options = {}) {
|
|
|
4352
4352
|
const { ordering = "relaxed", allowRepeatedSteps = true } = comparisonOptions;
|
|
4353
4353
|
const staticExpectedSteps = Array.isArray(staticExpectedTrajectory) ? staticExpectedTrajectory : staticExpectedTrajectory?.steps.map(trajectoryStepToExpectedStep);
|
|
4354
4354
|
const getDescription = () => {
|
|
4355
|
-
if (staticExpectedSteps) return `Evaluates whether the trajectory matches the expected path: [${staticExpectedSteps.map((s) => s.name).join("
|
|
4355
|
+
if (staticExpectedSteps) return `Evaluates whether the trajectory matches the expected path: [${staticExpectedSteps.map((s) => s.name).join(" \u2192 ")}] (${ordering} ordering)`;
|
|
4356
4356
|
return `Evaluates trajectory accuracy against expected trajectory from dataset items (${ordering} ordering)`;
|
|
4357
4357
|
};
|
|
4358
4358
|
return createScorer({
|
|
@@ -4639,7 +4639,7 @@ function createTrajectoryScorerCode(options = {}) {
|
|
|
4639
4639
|
if (blacklist && blacklist.score === 0) {
|
|
4640
4640
|
const violations = [];
|
|
4641
4641
|
if (blacklist.violatedTools.length > 0) violations.push(`forbidden tools used: ${blacklist.violatedTools.join(", ")}`);
|
|
4642
|
-
if (blacklist.violatedSequences.length > 0) violations.push(`forbidden sequences: ${blacklist.violatedSequences.map((s) => s.join("
|
|
4642
|
+
if (blacklist.violatedSequences.length > 0) violations.push(`forbidden sequences: ${blacklist.violatedSequences.map((s) => s.join(" \u2192 ")).join("; ")}`);
|
|
4643
4643
|
parts.push(`Blacklist violation: ${violations.join(". ")}.`);
|
|
4644
4644
|
return parts.join("\n");
|
|
4645
4645
|
}
|
package/dist/vitest/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_matchers = require("../matchers-
|
|
2
|
+
const require_matchers = require("../matchers-DzscWdy_.cjs");
|
|
3
3
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
4
4
|
// src/vitest/meta.ts
|
|
5
5
|
/**
|
|
@@ -53,11 +53,11 @@ async function attachMetaToCurrentTest(result) {
|
|
|
53
53
|
function assertPassRate(result, minPassRate) {
|
|
54
54
|
if (!Number.isFinite(minPassRate) || minPassRate < 0 || minPassRate > 1) throw new Error(`toPass(minPassRate): minPassRate must be within [0, 1], got ${minPassRate}`);
|
|
55
55
|
const lines = [];
|
|
56
|
-
for (const gate of result.gateResults ?? []) if (gate.score < minPassRate) lines.push(`
|
|
57
|
-
for (const t of result.thresholdResults ?? []) if (!t.passed) lines.push(`
|
|
56
|
+
for (const gate of result.gateResults ?? []) if (gate.score < minPassRate) lines.push(` \u2717 gate ${gate.id}: pass rate ${formatRate(gate.score)} < required ${formatRate(minPassRate)}`);
|
|
57
|
+
for (const t of result.thresholdResults ?? []) if (!t.passed) lines.push(` \u2717 threshold ${t.id}: average score ${t.averageScore} (threshold: ${JSON.stringify(t.threshold)})`);
|
|
58
58
|
for (const turn of result.turnResults ?? []) {
|
|
59
|
-
for (const gate of turn.gateResults ?? []) if (gate.score < minPassRate) lines.push(`
|
|
60
|
-
for (const t of turn.thresholdResults ?? []) if (!t.passed) lines.push(`
|
|
59
|
+
for (const gate of turn.gateResults ?? []) if (gate.score < minPassRate) lines.push(` \u2717 turn ${turn.index} gate ${gate.id}: pass rate ${formatRate(gate.score)} < required ${formatRate(minPassRate)}`);
|
|
60
|
+
for (const t of turn.thresholdResults ?? []) if (!t.passed) lines.push(` \u2717 turn ${turn.index} threshold ${t.id}: average score ${t.averageScore} (threshold: ${JSON.stringify(t.threshold)})`);
|
|
61
61
|
}
|
|
62
62
|
if (lines.length > 0) throw new EvalPassRateError([`Eval did not pass (required pass rate: ${formatRate(minPassRate)}).`, ...lines].join("\n"), result);
|
|
63
63
|
}
|
|
@@ -229,12 +229,12 @@ var MastraEvalsReporter = class {
|
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
verdictBadge(verdict) {
|
|
232
|
-
if (verdict === "passed") return this.style(GREEN, "
|
|
233
|
-
if (verdict === "failed") return this.style(RED, "
|
|
234
|
-
return this.style(YELLOW, "
|
|
232
|
+
if (verdict === "passed") return this.style(GREEN, "\u2713");
|
|
233
|
+
if (verdict === "failed") return this.style(RED, "\u2717");
|
|
234
|
+
return this.style(YELLOW, "\u2022");
|
|
235
235
|
}
|
|
236
236
|
passMark(passed) {
|
|
237
|
-
return passed ? this.style(GREEN, "
|
|
237
|
+
return passed ? this.style(GREEN, "\u2713") : this.style(RED, "\u2717");
|
|
238
238
|
}
|
|
239
239
|
style(code, text) {
|
|
240
240
|
return this.color ? `${code}${text}${RESET}` : text;
|
package/dist/vitest/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as registerEvalMatchers, t as evalMatchers } from "../matchers-
|
|
1
|
+
import { n as registerEvalMatchers, t as evalMatchers } from "../matchers-BRqioXz6.js";
|
|
2
2
|
import { runEvals } from "@mastra/core/evals";
|
|
3
3
|
// src/vitest/meta.ts
|
|
4
4
|
/**
|
|
@@ -52,11 +52,11 @@ async function attachMetaToCurrentTest(result) {
|
|
|
52
52
|
function assertPassRate(result, minPassRate) {
|
|
53
53
|
if (!Number.isFinite(minPassRate) || minPassRate < 0 || minPassRate > 1) throw new Error(`toPass(minPassRate): minPassRate must be within [0, 1], got ${minPassRate}`);
|
|
54
54
|
const lines = [];
|
|
55
|
-
for (const gate of result.gateResults ?? []) if (gate.score < minPassRate) lines.push(`
|
|
56
|
-
for (const t of result.thresholdResults ?? []) if (!t.passed) lines.push(`
|
|
55
|
+
for (const gate of result.gateResults ?? []) if (gate.score < minPassRate) lines.push(` \u2717 gate ${gate.id}: pass rate ${formatRate(gate.score)} < required ${formatRate(minPassRate)}`);
|
|
56
|
+
for (const t of result.thresholdResults ?? []) if (!t.passed) lines.push(` \u2717 threshold ${t.id}: average score ${t.averageScore} (threshold: ${JSON.stringify(t.threshold)})`);
|
|
57
57
|
for (const turn of result.turnResults ?? []) {
|
|
58
|
-
for (const gate of turn.gateResults ?? []) if (gate.score < minPassRate) lines.push(`
|
|
59
|
-
for (const t of turn.thresholdResults ?? []) if (!t.passed) lines.push(`
|
|
58
|
+
for (const gate of turn.gateResults ?? []) if (gate.score < minPassRate) lines.push(` \u2717 turn ${turn.index} gate ${gate.id}: pass rate ${formatRate(gate.score)} < required ${formatRate(minPassRate)}`);
|
|
59
|
+
for (const t of turn.thresholdResults ?? []) if (!t.passed) lines.push(` \u2717 turn ${turn.index} threshold ${t.id}: average score ${t.averageScore} (threshold: ${JSON.stringify(t.threshold)})`);
|
|
60
60
|
}
|
|
61
61
|
if (lines.length > 0) throw new EvalPassRateError([`Eval did not pass (required pass rate: ${formatRate(minPassRate)}).`, ...lines].join("\n"), result);
|
|
62
62
|
}
|
|
@@ -228,12 +228,12 @@ var MastraEvalsReporter = class {
|
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
verdictBadge(verdict) {
|
|
231
|
-
if (verdict === "passed") return this.style(GREEN, "
|
|
232
|
-
if (verdict === "failed") return this.style(RED, "
|
|
233
|
-
return this.style(YELLOW, "
|
|
231
|
+
if (verdict === "passed") return this.style(GREEN, "\u2713");
|
|
232
|
+
if (verdict === "failed") return this.style(RED, "\u2717");
|
|
233
|
+
return this.style(YELLOW, "\u2022");
|
|
234
234
|
}
|
|
235
235
|
passMark(passed) {
|
|
236
|
-
return passed ? this.style(GREEN, "
|
|
236
|
+
return passed ? this.style(GREEN, "\u2713") : this.style(RED, "\u2717");
|
|
237
237
|
}
|
|
238
238
|
style(code, text) {
|
|
239
239
|
return this.color ? `${code}${text}${RESET}` : text;
|
package/dist/vitest/setup.cjs
CHANGED
package/dist/vitest/setup.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/evals",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.13-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -115,10 +115,10 @@
|
|
|
115
115
|
"zod": "^4.6.7",
|
|
116
116
|
"@internal/ai-sdk-v5": "0.0.99",
|
|
117
117
|
"@internal/lint": "0.0.152",
|
|
118
|
+
"@internal/llm-recorder": "0.0.88",
|
|
118
119
|
"@internal/test-utils": "0.0.88",
|
|
119
120
|
"@internal/types-builder": "0.0.127",
|
|
120
|
-
"@
|
|
121
|
-
"@mastra/core": "1.86.0"
|
|
121
|
+
"@mastra/core": "1.87.0-alpha.0"
|
|
122
122
|
},
|
|
123
123
|
"engines": {
|
|
124
124
|
"node": ">=22.13.0"
|