@axlsdk/axl 0.2.0 → 0.3.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/dist/index.cjs +51 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +51 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4722,6 +4722,7 @@ var AxlRuntime = class extends import_node_events2.EventEmitter {
|
|
|
4722
4722
|
executions = /* @__PURE__ */ new Map();
|
|
4723
4723
|
pendingDecisionResolvers = /* @__PURE__ */ new Map();
|
|
4724
4724
|
abortControllers = /* @__PURE__ */ new Map();
|
|
4725
|
+
registeredEvals = /* @__PURE__ */ new Map();
|
|
4725
4726
|
mcpManager;
|
|
4726
4727
|
memoryManager;
|
|
4727
4728
|
spanManager = new NoopSpanManager();
|
|
@@ -4817,6 +4818,52 @@ var AxlRuntime = class extends import_node_events2.EventEmitter {
|
|
|
4817
4818
|
getAgent(name) {
|
|
4818
4819
|
return this.agents.get(name);
|
|
4819
4820
|
}
|
|
4821
|
+
/**
|
|
4822
|
+
* Register an eval config for Studio introspection and execution.
|
|
4823
|
+
* The config should be the result of `defineEval()` from `@axlsdk/eval`.
|
|
4824
|
+
* An optional `executeWorkflow` function can override the default behavior
|
|
4825
|
+
* of calling `runtime.execute()`.
|
|
4826
|
+
*/
|
|
4827
|
+
registerEval(name, config, executeWorkflow) {
|
|
4828
|
+
this.registeredEvals.set(name, { config, executeWorkflow });
|
|
4829
|
+
}
|
|
4830
|
+
/** Get metadata about all registered evals. */
|
|
4831
|
+
getRegisteredEvals() {
|
|
4832
|
+
const result = [];
|
|
4833
|
+
for (const [name, { config }] of this.registeredEvals) {
|
|
4834
|
+
const cfg = config;
|
|
4835
|
+
result.push({
|
|
4836
|
+
name,
|
|
4837
|
+
workflow: cfg.workflow ?? "unknown",
|
|
4838
|
+
dataset: cfg.dataset?.name ?? "unknown",
|
|
4839
|
+
scorers: (cfg.scorers ?? []).map((s) => s.name ?? "unknown")
|
|
4840
|
+
});
|
|
4841
|
+
}
|
|
4842
|
+
return result;
|
|
4843
|
+
}
|
|
4844
|
+
/** Get a registered eval config by name. */
|
|
4845
|
+
getRegisteredEval(name) {
|
|
4846
|
+
return this.registeredEvals.get(name);
|
|
4847
|
+
}
|
|
4848
|
+
/** Run a registered eval by name. */
|
|
4849
|
+
async runRegisteredEval(name) {
|
|
4850
|
+
const entry = this.registeredEvals.get(name);
|
|
4851
|
+
if (!entry) throw new Error(`Eval "${name}" is not registered`);
|
|
4852
|
+
if (entry.executeWorkflow) {
|
|
4853
|
+
let runEvalFn;
|
|
4854
|
+
try {
|
|
4855
|
+
({ runEval: runEvalFn } = await import("@axlsdk/eval"));
|
|
4856
|
+
} catch {
|
|
4857
|
+
throw new Error(
|
|
4858
|
+
"axl-eval is required for AxlRuntime.runRegisteredEval(). Install it with: npm install @axlsdk/eval"
|
|
4859
|
+
);
|
|
4860
|
+
}
|
|
4861
|
+
return runEvalFn(entry.config, entry.executeWorkflow);
|
|
4862
|
+
}
|
|
4863
|
+
return this.eval(
|
|
4864
|
+
entry.config
|
|
4865
|
+
);
|
|
4866
|
+
}
|
|
4820
4867
|
/** Get all execution info (running + completed). */
|
|
4821
4868
|
getExecutions() {
|
|
4822
4869
|
return [...this.executions.values()];
|
|
@@ -5200,10 +5247,10 @@ var AxlRuntime = class extends import_node_events2.EventEmitter {
|
|
|
5200
5247
|
async eval(config) {
|
|
5201
5248
|
let runEval;
|
|
5202
5249
|
try {
|
|
5203
|
-
({ runEval } = await import("
|
|
5250
|
+
({ runEval } = await import("@axlsdk/eval"));
|
|
5204
5251
|
} catch {
|
|
5205
5252
|
throw new Error(
|
|
5206
|
-
"axl-eval is required for AxlRuntime.eval(). Install it with: npm install
|
|
5253
|
+
"axl-eval is required for AxlRuntime.eval(). Install it with: npm install @axlsdk/eval"
|
|
5207
5254
|
);
|
|
5208
5255
|
}
|
|
5209
5256
|
const executeWorkflow = async (input) => {
|
|
@@ -5230,10 +5277,10 @@ var AxlRuntime = class extends import_node_events2.EventEmitter {
|
|
|
5230
5277
|
async evalCompare(baseline, candidate) {
|
|
5231
5278
|
let evalCompareFn;
|
|
5232
5279
|
try {
|
|
5233
|
-
({ evalCompare: evalCompareFn } = await import("
|
|
5280
|
+
({ evalCompare: evalCompareFn } = await import("@axlsdk/eval"));
|
|
5234
5281
|
} catch {
|
|
5235
5282
|
throw new Error(
|
|
5236
|
-
"axl-eval is required for AxlRuntime.evalCompare(). Install it with: npm install
|
|
5283
|
+
"axl-eval is required for AxlRuntime.evalCompare(). Install it with: npm install @axlsdk/eval"
|
|
5237
5284
|
);
|
|
5238
5285
|
}
|
|
5239
5286
|
return evalCompareFn(baseline, candidate);
|