@wix/evalforge-evaluator 0.93.0 → 0.95.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/build/index.js +18 -10
- package/build/index.js.map +2 -2
- package/build/index.mjs +18 -10
- package/build/index.mjs.map +2 -2
- package/package.json +5 -5
package/build/index.mjs
CHANGED
|
@@ -203,23 +203,15 @@ function applyParamsToAssertion(assertion, params) {
|
|
|
203
203
|
}
|
|
204
204
|
if (assertion.type === "llm_judge") {
|
|
205
205
|
let prompt = assertion.prompt;
|
|
206
|
-
let systemPrompt = assertion.systemPrompt;
|
|
207
206
|
for (const [key, value] of Object.entries(params)) {
|
|
208
207
|
const placeholder = `{{${key}}}`;
|
|
209
208
|
const escapedPlaceholder = placeholder.replace(/[{}]/g, "\\$&");
|
|
210
209
|
const replacement = String(value ?? "");
|
|
211
210
|
prompt = prompt.replace(new RegExp(escapedPlaceholder, "g"), replacement);
|
|
212
|
-
if (systemPrompt) {
|
|
213
|
-
systemPrompt = systemPrompt.replace(
|
|
214
|
-
new RegExp(escapedPlaceholder, "g"),
|
|
215
|
-
replacement
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
211
|
}
|
|
219
212
|
return {
|
|
220
213
|
...assertion,
|
|
221
214
|
prompt,
|
|
222
|
-
systemPrompt,
|
|
223
215
|
...params.model !== void 0 && { model: params.model },
|
|
224
216
|
...params.maxTokens !== void 0 && {
|
|
225
217
|
maxTokens: params.maxTokens
|
|
@@ -244,6 +236,17 @@ function applyParamsToAssertion(assertion, params) {
|
|
|
244
236
|
skillNames: parseSkillNamesFromParams(params.skillNames)
|
|
245
237
|
};
|
|
246
238
|
}
|
|
239
|
+
if (assertion.type === "tool_called_with_param") {
|
|
240
|
+
return {
|
|
241
|
+
...assertion,
|
|
242
|
+
...params.toolName !== void 0 && {
|
|
243
|
+
toolName: params.toolName
|
|
244
|
+
},
|
|
245
|
+
...params.expectedParams !== void 0 && {
|
|
246
|
+
expectedParams: params.expectedParams
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
247
250
|
return { ...assertion, ...params };
|
|
248
251
|
}
|
|
249
252
|
function resolveSystemAssertion(assertionId, params) {
|
|
@@ -256,6 +259,13 @@ function resolveSystemAssertion(assertionId, params) {
|
|
|
256
259
|
skillNames: parseSkillNamesFromParams(params?.skillNames)
|
|
257
260
|
};
|
|
258
261
|
break;
|
|
262
|
+
case "tool_called_with_param":
|
|
263
|
+
baseAssertion = {
|
|
264
|
+
type: "tool_called_with_param",
|
|
265
|
+
toolName: params?.toolName ?? "",
|
|
266
|
+
expectedParams: params?.expectedParams ?? "{}"
|
|
267
|
+
};
|
|
268
|
+
break;
|
|
259
269
|
case "build_passed":
|
|
260
270
|
baseAssertion = {
|
|
261
271
|
type: "build_passed",
|
|
@@ -279,7 +289,6 @@ function resolveSystemAssertion(assertionId, params) {
|
|
|
279
289
|
baseAssertion = {
|
|
280
290
|
type: "llm_judge",
|
|
281
291
|
prompt: params?.prompt ?? "",
|
|
282
|
-
systemPrompt: params?.systemPrompt,
|
|
283
292
|
minScore: params?.minScore,
|
|
284
293
|
model: params?.model,
|
|
285
294
|
maxTokens: params?.maxTokens,
|
|
@@ -296,7 +305,6 @@ function customAssertionToAssertion(ca, params) {
|
|
|
296
305
|
const baseAssertion = {
|
|
297
306
|
type: "llm_judge",
|
|
298
307
|
prompt: config?.prompt ?? "",
|
|
299
|
-
systemPrompt: config?.systemPrompt,
|
|
300
308
|
minScore: config?.minScore,
|
|
301
309
|
model: config?.model,
|
|
302
310
|
maxTokens: config?.maxTokens,
|