@wix/evalforge-evaluator 0.149.0 → 0.151.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 +15 -2
- package/build/index.js.map +3 -3
- package/build/index.mjs +15 -2
- package/build/index.mjs.map +3 -3
- package/build/types/substitute-variables.d.ts +1 -0
- package/package.json +5 -5
package/build/index.js
CHANGED
|
@@ -4716,6 +4716,15 @@ function extractTemplateFiles(before, after, infrastructurePaths) {
|
|
|
4716
4716
|
return files;
|
|
4717
4717
|
}
|
|
4718
4718
|
|
|
4719
|
+
// src/substitute-variables.ts
|
|
4720
|
+
function substituteVariables(prompt, variables) {
|
|
4721
|
+
if (!variables || Object.keys(variables).length === 0) return prompt;
|
|
4722
|
+
return prompt.replace(
|
|
4723
|
+
/\{\{([\w-]+)\}\}/g,
|
|
4724
|
+
(original, key) => key in variables ? variables[key] : original
|
|
4725
|
+
);
|
|
4726
|
+
}
|
|
4727
|
+
|
|
4719
4728
|
// src/run-scenario/run-agent-with-context.ts
|
|
4720
4729
|
var import_evalforge_types12 = require("@wix/evalforge-types");
|
|
4721
4730
|
var DEFAULT_AGENT_COMMAND = import_evalforge_types12.AgentRunCommand.CLAUDE;
|
|
@@ -4728,9 +4737,13 @@ async function runAgentWithContext(config, evalRunId2, scenario, evalData, workD
|
|
|
4728
4737
|
const targetId = evalData.evalRun.presetId ?? agent?.id ?? evalData.evalRun.id;
|
|
4729
4738
|
const targetName = evalData.presetName || agent?.name || "";
|
|
4730
4739
|
const agentConfig = agent?.config;
|
|
4740
|
+
const resolvedTriggerPrompt = substituteVariables(
|
|
4741
|
+
scenario.triggerPrompt,
|
|
4742
|
+
evalData.evalRun.variables
|
|
4743
|
+
);
|
|
4731
4744
|
const executionContext = {
|
|
4732
4745
|
skills: evalData.skills,
|
|
4733
|
-
scenario,
|
|
4746
|
+
scenario: { ...scenario, triggerPrompt: resolvedTriggerPrompt },
|
|
4734
4747
|
cwd: workDir || process.cwd(),
|
|
4735
4748
|
config: agentConfig,
|
|
4736
4749
|
aiGatewayUrl: config.aiGatewayUrl,
|
|
@@ -4785,7 +4798,7 @@ async function runAgentWithContext(config, evalRunId2, scenario, evalData, workD
|
|
|
4785
4798
|
targetName,
|
|
4786
4799
|
scenarioId: scenario.id,
|
|
4787
4800
|
scenarioName: scenario.name,
|
|
4788
|
-
triggerPrompt:
|
|
4801
|
+
triggerPrompt: resolvedTriggerPrompt,
|
|
4789
4802
|
modelConfig: snapshotModelConfig,
|
|
4790
4803
|
duration: durationMs,
|
|
4791
4804
|
outputText,
|