@wix/evalforge-evaluator 0.150.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.mjs
CHANGED
|
@@ -4734,6 +4734,15 @@ function extractTemplateFiles(before, after, infrastructurePaths) {
|
|
|
4734
4734
|
return files;
|
|
4735
4735
|
}
|
|
4736
4736
|
|
|
4737
|
+
// src/substitute-variables.ts
|
|
4738
|
+
function substituteVariables(prompt, variables) {
|
|
4739
|
+
if (!variables || Object.keys(variables).length === 0) return prompt;
|
|
4740
|
+
return prompt.replace(
|
|
4741
|
+
/\{\{([\w-]+)\}\}/g,
|
|
4742
|
+
(original, key) => key in variables ? variables[key] : original
|
|
4743
|
+
);
|
|
4744
|
+
}
|
|
4745
|
+
|
|
4737
4746
|
// src/run-scenario/run-agent-with-context.ts
|
|
4738
4747
|
import { AgentRunCommand as AgentRunCommand3, AgentType } from "@wix/evalforge-types";
|
|
4739
4748
|
var DEFAULT_AGENT_COMMAND = AgentRunCommand3.CLAUDE;
|
|
@@ -4746,9 +4755,13 @@ async function runAgentWithContext(config, evalRunId2, scenario, evalData, workD
|
|
|
4746
4755
|
const targetId = evalData.evalRun.presetId ?? agent?.id ?? evalData.evalRun.id;
|
|
4747
4756
|
const targetName = evalData.presetName || agent?.name || "";
|
|
4748
4757
|
const agentConfig = agent?.config;
|
|
4758
|
+
const resolvedTriggerPrompt = substituteVariables(
|
|
4759
|
+
scenario.triggerPrompt,
|
|
4760
|
+
evalData.evalRun.variables
|
|
4761
|
+
);
|
|
4749
4762
|
const executionContext = {
|
|
4750
4763
|
skills: evalData.skills,
|
|
4751
|
-
scenario,
|
|
4764
|
+
scenario: { ...scenario, triggerPrompt: resolvedTriggerPrompt },
|
|
4752
4765
|
cwd: workDir || process.cwd(),
|
|
4753
4766
|
config: agentConfig,
|
|
4754
4767
|
aiGatewayUrl: config.aiGatewayUrl,
|
|
@@ -4803,7 +4816,7 @@ async function runAgentWithContext(config, evalRunId2, scenario, evalData, workD
|
|
|
4803
4816
|
targetName,
|
|
4804
4817
|
scenarioId: scenario.id,
|
|
4805
4818
|
scenarioName: scenario.name,
|
|
4806
|
-
triggerPrompt:
|
|
4819
|
+
triggerPrompt: resolvedTriggerPrompt,
|
|
4807
4820
|
modelConfig: snapshotModelConfig,
|
|
4808
4821
|
duration: durationMs,
|
|
4809
4822
|
outputText,
|