@salesforce/plugin-agent 1.30.11 → 1.31.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/README.md +19 -19
- package/lib/commands/agent/test/run-eval.d.ts +33 -0
- package/lib/commands/agent/test/run-eval.js +221 -0
- package/lib/commands/agent/test/run-eval.js.map +1 -0
- package/lib/evalFormatter.d.ts +30 -0
- package/lib/evalFormatter.js +263 -0
- package/lib/evalFormatter.js.map +1 -0
- package/lib/evalNormalizer.d.ts +57 -0
- package/lib/evalNormalizer.js +421 -0
- package/lib/evalNormalizer.js.map +1 -0
- package/lib/yamlSpecTranslator.d.ts +20 -0
- package/lib/yamlSpecTranslator.js +217 -0
- package/lib/yamlSpecTranslator.js.map +1 -0
- package/messages/agent.test.run-eval.md +91 -0
- package/oclif.manifest.json +219 -91
- package/package.json +5 -5
- package/schemas/agent-test-run__eval.json +52 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
// --- Evaluator classification ---
|
|
17
|
+
const SCORING_EVALUATORS = new Set([
|
|
18
|
+
'evaluator.text_alignment',
|
|
19
|
+
'evaluator.hallucination_detection',
|
|
20
|
+
'evaluator.citation_recall',
|
|
21
|
+
'evaluator.answer_faithfulness',
|
|
22
|
+
]);
|
|
23
|
+
const ASSERTION_EVALUATORS = new Set(['evaluator.string_assertion', 'evaluator.json_assertion']);
|
|
24
|
+
const DEFAULT_METRIC_NAMES = {
|
|
25
|
+
'evaluator.text_alignment': 'base.cosine_similarity',
|
|
26
|
+
'evaluator.hallucination_detection': 'hallucination_detection',
|
|
27
|
+
'evaluator.citation_recall': 'citation_recall',
|
|
28
|
+
'evaluator.answer_faithfulness': 'answer_faithfulness',
|
|
29
|
+
};
|
|
30
|
+
const SCORING_VALID_FIELDS = new Set([
|
|
31
|
+
'type',
|
|
32
|
+
'id',
|
|
33
|
+
'generated_output',
|
|
34
|
+
'reference_answer',
|
|
35
|
+
'metric_name',
|
|
36
|
+
'threshold',
|
|
37
|
+
]);
|
|
38
|
+
const ASSERTION_VALID_FIELDS = new Set([
|
|
39
|
+
'type',
|
|
40
|
+
'id',
|
|
41
|
+
'actual',
|
|
42
|
+
'expected',
|
|
43
|
+
'operator',
|
|
44
|
+
'threshold',
|
|
45
|
+
'json_path',
|
|
46
|
+
'json_schema',
|
|
47
|
+
'metric_name',
|
|
48
|
+
]);
|
|
49
|
+
const VALID_AGENT_FIELDS = {
|
|
50
|
+
'agent.create_session': new Set(['type', 'id', 'agent_id', 'agent_version_id', 'use_agent_api', 'planner_id']),
|
|
51
|
+
'agent.send_message': new Set(['type', 'id', 'session_id', 'utterance']),
|
|
52
|
+
'agent.get_state': new Set(['type', 'id', 'session_id']),
|
|
53
|
+
};
|
|
54
|
+
// --- Auto-correction maps ---
|
|
55
|
+
const AGENT_CORRECTIONS = {
|
|
56
|
+
agentId: 'agent_id',
|
|
57
|
+
agentVersionId: 'agent_version_id',
|
|
58
|
+
sessionId: 'session_id',
|
|
59
|
+
text: 'utterance',
|
|
60
|
+
message: 'utterance',
|
|
61
|
+
input: 'utterance',
|
|
62
|
+
prompt: 'utterance',
|
|
63
|
+
user_message: 'utterance',
|
|
64
|
+
userMessage: 'utterance',
|
|
65
|
+
};
|
|
66
|
+
const EVALUATOR_CORRECTIONS = {
|
|
67
|
+
subject: 'actual',
|
|
68
|
+
expectedValue: 'expected',
|
|
69
|
+
expected_value: 'expected',
|
|
70
|
+
actualValue: 'actual',
|
|
71
|
+
actual_value: 'actual',
|
|
72
|
+
assertionType: 'operator',
|
|
73
|
+
assertion_type: 'operator',
|
|
74
|
+
comparator: 'operator',
|
|
75
|
+
};
|
|
76
|
+
// --- camelCase alias maps for agent.create_session ---
|
|
77
|
+
const AGENT_FIELD_ALIASES = {
|
|
78
|
+
useAgentApi: 'use_agent_api',
|
|
79
|
+
plannerId: 'planner_id',
|
|
80
|
+
plannerDefinitionId: 'planner_id',
|
|
81
|
+
planner_definition_id: 'planner_id',
|
|
82
|
+
planner_version_id: 'planner_id',
|
|
83
|
+
plannerVersionId: 'planner_id',
|
|
84
|
+
};
|
|
85
|
+
// --- Scoring evaluator field aliases ---
|
|
86
|
+
const SCORING_FIELD_ALIASES = {
|
|
87
|
+
actual: 'generated_output',
|
|
88
|
+
expected: 'reference_answer',
|
|
89
|
+
actual_value: 'generated_output',
|
|
90
|
+
expected_value: 'reference_answer',
|
|
91
|
+
actual_output: 'generated_output',
|
|
92
|
+
expected_output: 'reference_answer',
|
|
93
|
+
response: 'generated_output',
|
|
94
|
+
ground_truth: 'reference_answer',
|
|
95
|
+
};
|
|
96
|
+
// --- Assertion evaluator field aliases ---
|
|
97
|
+
const ASSERTION_FIELD_ALIASES = {
|
|
98
|
+
actual_value: 'actual',
|
|
99
|
+
expected_value: 'expected',
|
|
100
|
+
generated_output: 'actual',
|
|
101
|
+
reference_answer: 'expected',
|
|
102
|
+
actual_output: 'actual',
|
|
103
|
+
expected_output: 'expected',
|
|
104
|
+
response: 'actual',
|
|
105
|
+
ground_truth: 'expected',
|
|
106
|
+
};
|
|
107
|
+
// --- MCP shorthand field mapping ---
|
|
108
|
+
// MCP uses `field: "gs1.planner_state.topic"` — map to Eval API `actual` with correct JSONPath
|
|
109
|
+
const MCP_FIELD_MAP = {
|
|
110
|
+
'planner_state.topic': 'response.planner_response.lastExecution.topic',
|
|
111
|
+
'planner_state.invokedActions': 'response.planner_response.lastExecution.invokedActions',
|
|
112
|
+
'planner_state.actionsSequence': 'response.planner_response.lastExecution.invokedActions',
|
|
113
|
+
response: 'response',
|
|
114
|
+
'response.messages': 'response',
|
|
115
|
+
};
|
|
116
|
+
// --- Main entry point ---
|
|
117
|
+
/**
|
|
118
|
+
* Apply all normalizations to a test payload.
|
|
119
|
+
* Passes run in order: mcp-shorthand -> auto-correct -> camelCase -> evaluator fields -> shorthand refs -> defaults -> strip.
|
|
120
|
+
*/
|
|
121
|
+
export function normalizePayload(payload) {
|
|
122
|
+
const normalized = {
|
|
123
|
+
tests: payload.tests.map((test) => {
|
|
124
|
+
let steps = [...test.steps];
|
|
125
|
+
steps = normalizeMcpShorthand(steps);
|
|
126
|
+
steps = autoCorrectFields(steps);
|
|
127
|
+
steps = normalizeCamelCase(steps);
|
|
128
|
+
steps = normalizeEvaluatorFields(steps);
|
|
129
|
+
steps = convertShorthandRefs(steps);
|
|
130
|
+
steps = injectDefaults(steps);
|
|
131
|
+
steps = stripUnrecognizedFields(steps);
|
|
132
|
+
return { ...test, steps };
|
|
133
|
+
}),
|
|
134
|
+
};
|
|
135
|
+
return normalized;
|
|
136
|
+
}
|
|
137
|
+
// --- Individual normalization passes ---
|
|
138
|
+
/**
|
|
139
|
+
* Convert MCP shorthand format to raw Eval API format.
|
|
140
|
+
* MCP uses type="evaluator" + evaluator_type, raw API uses type="evaluator.xxx".
|
|
141
|
+
* Also maps `field` to `actual` with proper JSONPath and auto-generates missing `id` fields.
|
|
142
|
+
*/
|
|
143
|
+
export function normalizeMcpShorthand(steps) {
|
|
144
|
+
let evalCounter = 0;
|
|
145
|
+
return steps.map((step) => {
|
|
146
|
+
const evaluator_type = step.evaluator_type;
|
|
147
|
+
// Only applies to MCP shorthand: type="evaluator" with evaluator_type field
|
|
148
|
+
if (step.type !== 'evaluator' || !evaluator_type)
|
|
149
|
+
return step;
|
|
150
|
+
const normalized = { ...step };
|
|
151
|
+
// Merge type: "evaluator" + evaluator_type: "xxx" → type: "evaluator.xxx"
|
|
152
|
+
normalized.type = `evaluator.${evaluator_type}`;
|
|
153
|
+
delete normalized.evaluator_type;
|
|
154
|
+
// Convert `field` to `actual` with proper shorthand ref format
|
|
155
|
+
if ('field' in normalized) {
|
|
156
|
+
if (!('actual' in normalized)) {
|
|
157
|
+
const fieldValue = normalized.field;
|
|
158
|
+
// Parse "gs1.planner_state.topic" → stepId="gs1", fieldPath="planner_state.topic"
|
|
159
|
+
const dotIdx = fieldValue.indexOf('.');
|
|
160
|
+
if (dotIdx > 0) {
|
|
161
|
+
const stepId = fieldValue.substring(0, dotIdx);
|
|
162
|
+
const fieldPath = fieldValue.substring(dotIdx + 1);
|
|
163
|
+
const mappedPath = MCP_FIELD_MAP[fieldPath] ?? fieldPath;
|
|
164
|
+
normalized.actual = `{${stepId}.${mappedPath}}`;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
normalized.actual = fieldValue;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
delete normalized.field;
|
|
171
|
+
}
|
|
172
|
+
// Auto-generate id if missing
|
|
173
|
+
if (!normalized.id || normalized.id === '') {
|
|
174
|
+
normalized.id = `eval_${evalCounter}`;
|
|
175
|
+
}
|
|
176
|
+
evalCounter++;
|
|
177
|
+
return normalized;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Auto-correct common field name mistakes.
|
|
182
|
+
* Maps wrong field names to correct ones (agentId->agent_id, text->utterance, etc.)
|
|
183
|
+
*/
|
|
184
|
+
export function autoCorrectFields(steps) {
|
|
185
|
+
return steps.map((step) => {
|
|
186
|
+
const corrected = { ...step };
|
|
187
|
+
const stepType = corrected.type ?? '';
|
|
188
|
+
if (stepType.startsWith('agent.')) {
|
|
189
|
+
for (const [wrong, correct] of Object.entries(AGENT_CORRECTIONS)) {
|
|
190
|
+
if (wrong in corrected && !(correct in corrected)) {
|
|
191
|
+
corrected[correct] = corrected[wrong];
|
|
192
|
+
delete corrected[wrong];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (stepType.startsWith('evaluator.')) {
|
|
197
|
+
for (const [wrong, correct] of Object.entries(EVALUATOR_CORRECTIONS)) {
|
|
198
|
+
if (wrong in corrected && !(correct in corrected)) {
|
|
199
|
+
corrected[correct] = corrected[wrong];
|
|
200
|
+
delete corrected[wrong];
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return corrected;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Normalize camelCase agent field names to snake_case.
|
|
209
|
+
* useAgentApi->use_agent_api, plannerDefinitionId->planner_id, etc.
|
|
210
|
+
*/
|
|
211
|
+
export function normalizeCamelCase(steps) {
|
|
212
|
+
return steps.map((step) => {
|
|
213
|
+
if (step.type !== 'agent.create_session')
|
|
214
|
+
return step;
|
|
215
|
+
const normalized = { ...step };
|
|
216
|
+
for (const [alias, canonical] of Object.entries(AGENT_FIELD_ALIASES)) {
|
|
217
|
+
if (alias in normalized) {
|
|
218
|
+
if (!(canonical in normalized)) {
|
|
219
|
+
normalized[canonical] = normalized[alias];
|
|
220
|
+
}
|
|
221
|
+
delete normalized[alias];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return normalized;
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Apply field aliases: remap alias keys to canonical keys, removing duplicates.
|
|
229
|
+
*/
|
|
230
|
+
function applyFieldAliases(step, aliases) {
|
|
231
|
+
for (const [alias, canonical] of Object.entries(aliases)) {
|
|
232
|
+
if (alias in step && !(canonical in step)) {
|
|
233
|
+
step[canonical] = step[alias];
|
|
234
|
+
delete step[alias];
|
|
235
|
+
}
|
|
236
|
+
else if (alias in step && canonical in step) {
|
|
237
|
+
delete step[alias];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Normalize a scoring evaluator step (field aliases + metric_name injection).
|
|
243
|
+
*/
|
|
244
|
+
function normalizeScoringEvaluator(normalized, evalType) {
|
|
245
|
+
applyFieldAliases(normalized, SCORING_FIELD_ALIASES);
|
|
246
|
+
// Auto-inject or correct metric_name
|
|
247
|
+
if (!('metric_name' in normalized)) {
|
|
248
|
+
const defaultMetric = DEFAULT_METRIC_NAMES[evalType];
|
|
249
|
+
if (defaultMetric) {
|
|
250
|
+
normalized.metric_name = defaultMetric;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
else if (normalized.metric_name === evalType.split('.')[1]) {
|
|
254
|
+
const defaultMetric = DEFAULT_METRIC_NAMES[evalType];
|
|
255
|
+
if (defaultMetric) {
|
|
256
|
+
normalized.metric_name = defaultMetric;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Normalize an assertion evaluator step (field aliases + operator lowercase + metric_name).
|
|
262
|
+
*/
|
|
263
|
+
function normalizeAssertionEvaluator(normalized, evalType) {
|
|
264
|
+
applyFieldAliases(normalized, ASSERTION_FIELD_ALIASES);
|
|
265
|
+
// Auto-lowercase operator
|
|
266
|
+
if ('operator' in normalized && typeof normalized.operator === 'string') {
|
|
267
|
+
normalized.operator = normalized.operator.toLowerCase();
|
|
268
|
+
}
|
|
269
|
+
// Auto-inject metric_name for assertion evaluators
|
|
270
|
+
if (!('metric_name' in normalized)) {
|
|
271
|
+
normalized.metric_name = evalType.split('.')[1];
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Normalize evaluator field names based on evaluator category.
|
|
276
|
+
* Maps actual/expected <-> generated_output/reference_answer.
|
|
277
|
+
* Also auto-lowercases operator values and auto-injects metric_name.
|
|
278
|
+
*/
|
|
279
|
+
export function normalizeEvaluatorFields(steps) {
|
|
280
|
+
return steps.map((step) => {
|
|
281
|
+
const evalType = step.type ?? '';
|
|
282
|
+
if (!evalType.startsWith('evaluator.'))
|
|
283
|
+
return step;
|
|
284
|
+
const normalized = { ...step };
|
|
285
|
+
if (SCORING_EVALUATORS.has(evalType)) {
|
|
286
|
+
normalizeScoringEvaluator(normalized, evalType);
|
|
287
|
+
}
|
|
288
|
+
else if (ASSERTION_EVALUATORS.has(evalType)) {
|
|
289
|
+
normalizeAssertionEvaluator(normalized, evalType);
|
|
290
|
+
}
|
|
291
|
+
// Don't inject metric_name for unknown evaluator types to avoid API validation errors
|
|
292
|
+
// Unknown evaluators like bot_response_rating and planner_topic_assertion don't use metric_name
|
|
293
|
+
return normalized;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Convert {step_id.field} shorthand references to JSONPath $.outputs[N].field.
|
|
298
|
+
* Builds step_id->index mapping from non-evaluator steps.
|
|
299
|
+
*/
|
|
300
|
+
export function convertShorthandRefs(steps) {
|
|
301
|
+
// Build step_id -> output-array index mapping
|
|
302
|
+
const stepIdToIdx = {};
|
|
303
|
+
let outputIdx = 0;
|
|
304
|
+
for (const step of steps) {
|
|
305
|
+
const sid = step.id;
|
|
306
|
+
const stype = step.type ?? '';
|
|
307
|
+
if (sid && !stype.startsWith('evaluator.')) {
|
|
308
|
+
stepIdToIdx[sid] = outputIdx;
|
|
309
|
+
outputIdx += 1;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const refPattern = /\{([^}]+)\}/g;
|
|
313
|
+
function replaceValue(value) {
|
|
314
|
+
if (typeof value !== 'string')
|
|
315
|
+
return value;
|
|
316
|
+
return value.replace(refPattern, (match, ref) => {
|
|
317
|
+
const dotIdx = ref.indexOf('.');
|
|
318
|
+
if (dotIdx < 0)
|
|
319
|
+
return match;
|
|
320
|
+
const sid = ref.substring(0, dotIdx);
|
|
321
|
+
let field = ref.substring(dotIdx + 1);
|
|
322
|
+
if (!(sid in stepIdToIdx))
|
|
323
|
+
return match;
|
|
324
|
+
const idx = stepIdToIdx[sid];
|
|
325
|
+
// Normalize legacy nested-response path to flat response
|
|
326
|
+
if (field.startsWith('response.messages')) {
|
|
327
|
+
field = 'response';
|
|
328
|
+
}
|
|
329
|
+
return `$.outputs[${idx}].${field}`;
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
return steps.map((step) => {
|
|
333
|
+
const newStep = {};
|
|
334
|
+
for (const [key, val] of Object.entries(step)) {
|
|
335
|
+
if (typeof val === 'string') {
|
|
336
|
+
newStep[key] = replaceValue(val);
|
|
337
|
+
}
|
|
338
|
+
else if (val !== null && typeof val === 'object' && !Array.isArray(val)) {
|
|
339
|
+
const newObj = {};
|
|
340
|
+
for (const [k, v] of Object.entries(val)) {
|
|
341
|
+
newObj[k] = typeof v === 'string' ? replaceValue(v) : v;
|
|
342
|
+
}
|
|
343
|
+
newStep[key] = newObj;
|
|
344
|
+
}
|
|
345
|
+
else if (Array.isArray(val)) {
|
|
346
|
+
newStep[key] = val.map((item) => typeof item === 'string' ? replaceValue(item) : item);
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
newStep[key] = val;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return newStep;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Inject default values:
|
|
357
|
+
* - use_agent_api=true on agent.create_session if neither use_agent_api nor planner_id present
|
|
358
|
+
*/
|
|
359
|
+
export function injectDefaults(steps) {
|
|
360
|
+
return steps.map((step) => {
|
|
361
|
+
if (step.type === 'agent.create_session') {
|
|
362
|
+
if (!('use_agent_api' in step) && !('planner_id' in step)) {
|
|
363
|
+
return { ...step, use_agent_api: true };
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return step;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Strip unrecognized fields from steps based on type-specific whitelists.
|
|
371
|
+
*/
|
|
372
|
+
export function stripUnrecognizedFields(steps) {
|
|
373
|
+
return steps.map((step) => {
|
|
374
|
+
const stepType = step.type ?? '';
|
|
375
|
+
// Agent steps
|
|
376
|
+
if (stepType in VALID_AGENT_FIELDS) {
|
|
377
|
+
const validFields = VALID_AGENT_FIELDS[stepType];
|
|
378
|
+
const stripped = {};
|
|
379
|
+
for (const [key, val] of Object.entries(step)) {
|
|
380
|
+
if (validFields.has(key)) {
|
|
381
|
+
stripped[key] = val;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return stripped;
|
|
385
|
+
}
|
|
386
|
+
// Scoring evaluators
|
|
387
|
+
if (SCORING_EVALUATORS.has(stepType)) {
|
|
388
|
+
const stripped = {};
|
|
389
|
+
for (const [key, val] of Object.entries(step)) {
|
|
390
|
+
if (SCORING_VALID_FIELDS.has(key)) {
|
|
391
|
+
stripped[key] = val;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return stripped;
|
|
395
|
+
}
|
|
396
|
+
// Assertion evaluators
|
|
397
|
+
if (ASSERTION_EVALUATORS.has(stepType)) {
|
|
398
|
+
const stripped = {};
|
|
399
|
+
for (const [key, val] of Object.entries(step)) {
|
|
400
|
+
if (ASSERTION_VALID_FIELDS.has(key)) {
|
|
401
|
+
stripped[key] = val;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return stripped;
|
|
405
|
+
}
|
|
406
|
+
// Unknown types: don't strip (to avoid breaking future evaluator types)
|
|
407
|
+
return step;
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
// --- Batch splitting ---
|
|
411
|
+
/**
|
|
412
|
+
* Split tests array into chunks of batchSize.
|
|
413
|
+
*/
|
|
414
|
+
export function splitIntoBatches(tests, batchSize) {
|
|
415
|
+
const batches = [];
|
|
416
|
+
for (let i = 0; i < tests.length; i += batchSize) {
|
|
417
|
+
batches.push(tests.slice(i, i + batchSize));
|
|
418
|
+
}
|
|
419
|
+
return batches;
|
|
420
|
+
}
|
|
421
|
+
//# sourceMappingURL=evalNormaliz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CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TestSpec, TestCase } from '@salesforce/agents';
|
|
2
|
+
import type { EvalPayload, EvalTest } from './evalNormalizer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if the content looks like a YAML TestSpec (has testCases + subjectName).
|
|
5
|
+
* Returns false for JSON EvalPayload, invalid content, or YAML missing required fields.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isYamlTestSpec(content: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Parse a YAML string into a TestSpec.
|
|
10
|
+
* Throws if the content is not valid YAML or is missing required fields.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseTestSpec(content: string): TestSpec;
|
|
13
|
+
/**
|
|
14
|
+
* Translate a full TestSpec into an EvalPayload.
|
|
15
|
+
*/
|
|
16
|
+
export declare function translateTestSpec(spec: TestSpec): EvalPayload;
|
|
17
|
+
/**
|
|
18
|
+
* Translate a single TestCase into an EvalTest with ordered steps.
|
|
19
|
+
*/
|
|
20
|
+
export declare function translateTestCase(testCase: TestCase, index: number, specName?: string): EvalTest;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/* eslint-disable camelcase */
|
|
17
|
+
import { parse as parseYaml } from 'yaml';
|
|
18
|
+
// --- JSONPath mappings from org model to Eval API refs ---
|
|
19
|
+
const ACTUAL_PATH_MAP = {
|
|
20
|
+
'$.generatedData.outcome': '{sm.response}',
|
|
21
|
+
'$.generatedData.topic': '{gs.response.planner_response.lastExecution.topic}',
|
|
22
|
+
'$.generatedData.invokedActions': '{gs.response.planner_response.lastExecution.invokedActions}',
|
|
23
|
+
'$.generatedData.actionsSequence': '{gs.response.planner_response.lastExecution.invokedActions}',
|
|
24
|
+
};
|
|
25
|
+
// --- Custom evaluation name to evaluator type mapping ---
|
|
26
|
+
const CUSTOM_EVAL_TYPE_MAP = {
|
|
27
|
+
string_comparison: 'evaluator.string_assertion',
|
|
28
|
+
numeric_comparison: 'evaluator.numeric_assertion',
|
|
29
|
+
};
|
|
30
|
+
// JSONPaths that require the get_state step
|
|
31
|
+
const PLANNER_PATHS = new Set([
|
|
32
|
+
'$.generatedData.topic',
|
|
33
|
+
'$.generatedData.invokedActions',
|
|
34
|
+
'$.generatedData.actionsSequence',
|
|
35
|
+
]);
|
|
36
|
+
// --- Public API ---
|
|
37
|
+
/**
|
|
38
|
+
* Returns true if the content looks like a YAML TestSpec (has testCases + subjectName).
|
|
39
|
+
* Returns false for JSON EvalPayload, invalid content, or YAML missing required fields.
|
|
40
|
+
*/
|
|
41
|
+
export function isYamlTestSpec(content) {
|
|
42
|
+
try {
|
|
43
|
+
const parsed = parseYaml(content);
|
|
44
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
const obj = parsed;
|
|
48
|
+
return Array.isArray(obj.testCases) && typeof obj.subjectName === 'string';
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parse a YAML string into a TestSpec.
|
|
56
|
+
* Throws if the content is not valid YAML or is missing required fields.
|
|
57
|
+
*/
|
|
58
|
+
export function parseTestSpec(content) {
|
|
59
|
+
const parsed = parseYaml(content);
|
|
60
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
61
|
+
throw new Error('Invalid TestSpec: expected a YAML object');
|
|
62
|
+
}
|
|
63
|
+
const obj = parsed;
|
|
64
|
+
if (!Array.isArray(obj.testCases)) {
|
|
65
|
+
throw new Error('Invalid TestSpec: missing testCases array');
|
|
66
|
+
}
|
|
67
|
+
if (typeof obj.subjectName !== 'string') {
|
|
68
|
+
throw new Error('Invalid TestSpec: missing subjectName');
|
|
69
|
+
}
|
|
70
|
+
if (typeof obj.name !== 'string') {
|
|
71
|
+
throw new Error('Invalid TestSpec: missing name');
|
|
72
|
+
}
|
|
73
|
+
return parsed;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Translate a full TestSpec into an EvalPayload.
|
|
77
|
+
*/
|
|
78
|
+
export function translateTestSpec(spec) {
|
|
79
|
+
return {
|
|
80
|
+
tests: spec.testCases.map((tc, idx) => translateTestCase(tc, idx, spec.name)),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Translate a single TestCase into an EvalTest with ordered steps.
|
|
85
|
+
*/
|
|
86
|
+
export function translateTestCase(testCase, index, specName) {
|
|
87
|
+
const id = specName ? `${specName}_case_${index}` : `test_case_${index}`;
|
|
88
|
+
const steps = [];
|
|
89
|
+
// 1. agent.create_session
|
|
90
|
+
steps.push({
|
|
91
|
+
type: 'agent.create_session',
|
|
92
|
+
id: 'cs',
|
|
93
|
+
use_agent_api: true,
|
|
94
|
+
});
|
|
95
|
+
// 2. Conversation history — only user messages become send_message steps
|
|
96
|
+
let historyIdx = 0;
|
|
97
|
+
if (testCase.conversationHistory) {
|
|
98
|
+
for (const entry of testCase.conversationHistory) {
|
|
99
|
+
if (entry.role === 'user') {
|
|
100
|
+
steps.push({
|
|
101
|
+
type: 'agent.send_message',
|
|
102
|
+
id: `history_${historyIdx}`,
|
|
103
|
+
session_id: '{cs.session_id}',
|
|
104
|
+
utterance: entry.message,
|
|
105
|
+
});
|
|
106
|
+
historyIdx++;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// 3. Test utterance
|
|
111
|
+
steps.push({
|
|
112
|
+
type: 'agent.send_message',
|
|
113
|
+
id: 'sm',
|
|
114
|
+
session_id: '{cs.session_id}',
|
|
115
|
+
utterance: testCase.utterance,
|
|
116
|
+
});
|
|
117
|
+
// 4. Determine if get_state is needed
|
|
118
|
+
const needsGetState = needsPlannerState(testCase);
|
|
119
|
+
if (needsGetState) {
|
|
120
|
+
steps.push({
|
|
121
|
+
type: 'agent.get_state',
|
|
122
|
+
id: 'gs',
|
|
123
|
+
session_id: '{cs.session_id}',
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
// 5. Evaluators
|
|
127
|
+
if (testCase.expectedTopic !== undefined) {
|
|
128
|
+
steps.push({
|
|
129
|
+
type: 'evaluator.planner_topic_assertion',
|
|
130
|
+
id: 'check_topic',
|
|
131
|
+
expected: testCase.expectedTopic,
|
|
132
|
+
actual: '{gs.response.planner_response.lastExecution.topic}',
|
|
133
|
+
operator: 'contains',
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (testCase.expectedActions !== undefined && testCase.expectedActions.length > 0) {
|
|
137
|
+
steps.push({
|
|
138
|
+
type: 'evaluator.planner_actions_assertion',
|
|
139
|
+
id: 'check_actions',
|
|
140
|
+
expected: testCase.expectedActions,
|
|
141
|
+
actual: '{gs.response.planner_response.lastExecution.invokedActions}',
|
|
142
|
+
operator: 'includes_items',
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (testCase.expectedOutcome !== undefined) {
|
|
146
|
+
steps.push({
|
|
147
|
+
type: 'evaluator.bot_response_rating',
|
|
148
|
+
id: 'check_outcome',
|
|
149
|
+
utterance: testCase.utterance,
|
|
150
|
+
expected: testCase.expectedOutcome,
|
|
151
|
+
actual: '{sm.response}',
|
|
152
|
+
threshold: 3.0,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
if (testCase.customEvaluations) {
|
|
156
|
+
testCase.customEvaluations.forEach((customEval, customIdx) => {
|
|
157
|
+
const step = translateCustomEvaluation(customEval, customIdx);
|
|
158
|
+
steps.push(step);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return { id, steps };
|
|
162
|
+
}
|
|
163
|
+
// --- Internal helpers ---
|
|
164
|
+
/**
|
|
165
|
+
* Determine whether the get_state step is needed for this test case.
|
|
166
|
+
*/
|
|
167
|
+
function needsPlannerState(testCase) {
|
|
168
|
+
if (testCase.expectedTopic !== undefined)
|
|
169
|
+
return true;
|
|
170
|
+
if (testCase.expectedActions !== undefined && testCase.expectedActions.length > 0)
|
|
171
|
+
return true;
|
|
172
|
+
if (testCase.customEvaluations) {
|
|
173
|
+
for (const customEval of testCase.customEvaluations) {
|
|
174
|
+
for (const param of customEval.parameters) {
|
|
175
|
+
if (param.name === 'actual' && PLANNER_PATHS.has(param.value)) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Translate a single customEvaluation entry into an EvalStep.
|
|
185
|
+
*/
|
|
186
|
+
function translateCustomEvaluation(customEval, index) {
|
|
187
|
+
const evalType = CUSTOM_EVAL_TYPE_MAP[customEval.name] ?? `evaluator.${customEval.name}`;
|
|
188
|
+
let operator = '';
|
|
189
|
+
let actual = '';
|
|
190
|
+
let expected = '';
|
|
191
|
+
for (const param of customEval.parameters) {
|
|
192
|
+
if (param.name === 'operator') {
|
|
193
|
+
operator = param.value;
|
|
194
|
+
}
|
|
195
|
+
else if (param.name === 'actual') {
|
|
196
|
+
actual = mapActualPath(param.value);
|
|
197
|
+
}
|
|
198
|
+
else if (param.name === 'expected') {
|
|
199
|
+
expected = param.value;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
type: evalType,
|
|
204
|
+
id: `custom_${index}`,
|
|
205
|
+
operator,
|
|
206
|
+
actual,
|
|
207
|
+
expected,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Map an org-model JSONPath to the Eval API shorthand ref.
|
|
212
|
+
* Unknown paths are returned as-is.
|
|
213
|
+
*/
|
|
214
|
+
function mapActualPath(path) {
|
|
215
|
+
return ACTUAL_PATH_MAP[path] ?? path;
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=yamlSpecTranslator.js.map
|