Files
cfw-autumn/apps/leaf/tests/evals/fixtures/expectations/response.ts
2026-06-11 18:35:41 +01:00

58 lines
1.2 KiB
TypeScript

import type {
ResponseAskedBeforeToolExpectation,
ResponseAskedExpectation,
ResponseConciseExpectation,
ResponseMentionsExpectation,
} from "./types.js";
export const response = {
asked: ({
notPhrases,
phrases,
}: {
phrases: string[];
notPhrases?: string[];
}): ResponseAskedExpectation => ({
...(notPhrases ? { notPhrases } : {}),
phrases,
type: "response.asked",
}),
askedBeforeTool: ({
notPhrases,
phrases,
toolName,
}: {
phrases: string[];
toolName: ResponseAskedBeforeToolExpectation["toolName"];
notPhrases?: string[];
}): ResponseAskedBeforeToolExpectation => ({
...(notPhrases ? { notPhrases } : {}),
phrases,
toolName,
type: "response.askedBeforeTool",
}),
/**
* LLM-judged conciseness: the final reply must state every required fact
* with zero removable sentences. Facts are checked semantically, not verbatim.
*/
concise: ({
required,
}: {
required: string[];
}): ResponseConciseExpectation => ({
required,
type: "response.concise",
}),
mentions: ({
notPhrases,
phrases,
}: {
phrases: string[];
notPhrases?: string[];
}): ResponseMentionsExpectation => ({
...(notPhrases ? { notPhrases } : {}),
phrases,
type: "response.mentions",
}),
};