@axlsdk/eval 0.17.2 → 0.17.4
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 +42 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -355,6 +355,48 @@ for (const item of results.items) {
|
|
|
355
355
|
|
|
356
356
|
`captureTraces` strips verbose-mode `agent_call_end.data.messages` snapshots and high-volume events (`token`, `partial_object`) from the captured array to keep memory bounded. The structural events you'd want for debugging — `agent_call_start`/`agent_call_end`, `tool_call_*`, gate events, `pipeline`, `verify`, `handoff_*` — are all retained.
|
|
357
357
|
|
|
358
|
+
#### Per-item live observation with `ctx.events`
|
|
359
|
+
|
|
360
|
+
`captureTraces` collects events for post-hoc inspection on `EvalItem.traces`. For **live** per-item observation — e.g., printing each item's `partial_object` snapshots as they stream during eval execution — use `ctx.events` inside your top-level `executeWorkflow` export. The two are complementary: `captureTraces` records the structural timeline; `ctx.events` is the live firehose.
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
// evals/extract.eval.ts
|
|
364
|
+
import { defineEval, dataset, scorer } from '@axlsdk/eval';
|
|
365
|
+
import type { AxlRuntime } from '@axlsdk/axl';
|
|
366
|
+
import { z } from 'zod';
|
|
367
|
+
import { extractor } from '../src/agents/extractor.js'; // your agent
|
|
368
|
+
|
|
369
|
+
const extractSchema = z.object({ id: z.string(), summary: z.string() });
|
|
370
|
+
|
|
371
|
+
export default defineEval({
|
|
372
|
+
workflow: 'extract-fields',
|
|
373
|
+
dataset: dataset({ items: [{ id: 'a', text: 'hello world' }] }),
|
|
374
|
+
scorers: [scorer({ name: 'has-id', score: ({ output }) => (output.id ? 1 : 0) })],
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
// Top-level export, NOT nested inside defineEval. The eval runner
|
|
378
|
+
// imports both the default-exported config AND this named function.
|
|
379
|
+
export async function executeWorkflow(
|
|
380
|
+
input: { id: string; text: string },
|
|
381
|
+
runtime: AxlRuntime,
|
|
382
|
+
) {
|
|
383
|
+
const ctx = runtime.createContext({ signal: AbortSignal.timeout(30_000) });
|
|
384
|
+
// Allocate the bus before the first ctx.ask() — the streaming gate
|
|
385
|
+
// is per-ask, and a late subscription leaves the in-flight ask
|
|
386
|
+
// through the non-streaming code path.
|
|
387
|
+
const events = ctx.events;
|
|
388
|
+
void (async () => {
|
|
389
|
+
for await (const partial of events.partialObjects) {
|
|
390
|
+
console.log(`[${input.id}] attempt ${partial.attempt}:`, partial.object);
|
|
391
|
+
}
|
|
392
|
+
})().catch((err) => console.error('observer failed:', err));
|
|
393
|
+
const output = await ctx.ask(extractor, input.text, { schema: extractSchema });
|
|
394
|
+
return { output };
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
The `signal` from `createContext` auto-disposes the bus on timeout, so the iterator terminates cleanly even if the eval item never emits a workflow terminal. See [`ctx.events`](../../docs/api-reference.md#ctxevents) for the full type reference.
|
|
399
|
+
|
|
358
400
|
## Comparing Results
|
|
359
401
|
|
|
360
402
|
Compare two runs to detect regressions and improvements. Runs must use the same dataset and scorers.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axlsdk/eval",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"description": "Evaluation framework for Axl agentic workflows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@axlsdk/axl": "0.17.
|
|
28
|
+
"@axlsdk/axl": "0.17.4"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"zod": "^4.0.0",
|