niceeval 0.15.1-canary.76 → 0.16.1
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/INDEX.md +45 -40
- package/dist/adapter-execution-trace.cjs.map +1 -1
- package/dist/adapter-execution-trace.d.cts +26 -0
- package/dist/adapter-execution-trace.d.mts +26 -0
- package/dist/adapter-execution-trace.d.ts +26 -0
- package/dist/adapter-usage.cjs.map +1 -1
- package/dist/adapter-usage.d.cts +9 -0
- package/dist/adapter-usage.d.mts +9 -0
- package/dist/adapter-usage.d.ts +9 -0
- package/dist/adapter.cjs +19 -4
- package/dist/adapter.cjs.map +1 -1
- package/dist/adapter.d.cts +37 -12
- package/dist/adapter.d.mts +37 -12
- package/dist/adapter.d.ts +37 -12
- package/dist/agents/ai-sdk.cjs +3 -0
- package/dist/agents/ai-sdk.cjs.map +1 -1
- package/dist/agents/bub.cjs +3 -0
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/claude-code-native.cjs +28 -2
- package/dist/agents/claude-code-native.cjs.map +1 -1
- package/dist/agents/claude-code.cjs +3 -0
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/codex.cjs +3 -0
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.cjs +9 -10
- package/dist/agents/coding-cli-versions.cjs.map +1 -1
- package/dist/agents/coding-cli-versions.d.cts +1 -1
- package/dist/agents/coding-cli-versions.d.mts +1 -1
- package/dist/agents/coding-cli-versions.d.ts +1 -1
- package/dist/agents/deepseek-harness.cjs +3 -0
- package/dist/agents/deepseek-harness.cjs.map +1 -1
- package/dist/agents/hermes.cjs +3 -0
- package/dist/agents/hermes.cjs.map +1 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +3 -2
- package/dist/agents/index.d.mts +3 -2
- package/dist/agents/index.d.ts +3 -2
- package/dist/agents/omp.cjs +3 -0
- package/dist/agents/omp.cjs.map +1 -1
- package/dist/agents/openai-compat.cjs +6 -0
- package/dist/agents/openai-compat.cjs.map +1 -1
- package/dist/agents/openclaw.cjs +3 -0
- package/dist/agents/openclaw.cjs.map +1 -1
- package/dist/agents/opencode.cjs +3 -0
- package/dist/agents/opencode.cjs.map +1 -1
- package/dist/agents/sdk-streams.cjs +9 -0
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/ui-message-stream.cjs +3 -0
- package/dist/agents/ui-message-stream.cjs.map +1 -1
- package/dist/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +27 -5
- package/dist/assertions/api.d.mts +27 -5
- package/dist/assertions/api.d.ts +27 -5
- package/dist/assertions/collection.cjs +6 -0
- package/dist/assertions/collection.cjs.map +1 -1
- package/dist/assertions/collection.d.cts +4 -2
- package/dist/assertions/collection.d.mts +4 -2
- package/dist/assertions/collection.d.ts +4 -2
- package/dist/assertions/collection.js +12 -8
- package/dist/assertions/context-match.cjs +70 -0
- package/dist/assertions/context-match.cjs.map +1 -0
- package/dist/assertions/context-match.d.cts +107 -0
- package/dist/assertions/context-match.d.mts +107 -0
- package/dist/assertions/context-match.d.ts +107 -0
- package/dist/assertions/context-match.js +12 -0
- package/dist/assertions/context-match.js.map +1 -0
- package/dist/assertions/full-content.cjs +109 -0
- package/dist/assertions/full-content.cjs.map +1 -0
- package/dist/assertions/full-content.d.cts +6 -0
- package/dist/assertions/full-content.d.mts +6 -0
- package/dist/assertions/full-content.d.ts +6 -0
- package/dist/assertions/full-content.js +12 -0
- package/dist/assertions/full-content.js.map +1 -0
- package/dist/assertions/judge-presets.cjs +2 -34
- package/dist/assertions/judge-presets.cjs.map +1 -1
- package/dist/assertions/judge-presets.d.cts +6 -9
- package/dist/assertions/judge-presets.d.mts +6 -9
- package/dist/assertions/judge-presets.d.ts +6 -9
- package/dist/assertions/judge-presets.js +8 -8
- package/dist/assertions/judge.cjs +107 -29
- package/dist/assertions/judge.cjs.map +1 -1
- package/dist/assertions/judge.d.cts +2 -0
- package/dist/assertions/judge.d.mts +2 -0
- package/dist/assertions/judge.d.ts +2 -0
- package/dist/assertions/match.cjs +244 -5
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +43 -3
- package/dist/assertions/match.d.mts +43 -3
- package/dist/assertions/match.d.ts +43 -3
- package/dist/assertions/match.js +88 -78
- package/dist/assertions/material.cjs +520 -0
- package/dist/assertions/material.cjs.map +1 -0
- package/dist/assertions/material.d.cts +56 -0
- package/dist/assertions/material.d.mts +56 -0
- package/dist/assertions/material.d.ts +56 -0
- package/dist/assertions/material.js +20 -0
- package/dist/assertions/material.js.map +1 -0
- package/dist/assertions/record/attachment.cjs +5 -2
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/codec.cjs +2 -1
- package/dist/assertions/record/codec.cjs.map +1 -1
- package/dist/assertions/record/model.cjs.map +1 -1
- package/dist/assertions/record/model.d.cts +6 -1
- package/dist/assertions/record/model.d.mts +6 -1
- package/dist/assertions/record/model.d.ts +6 -1
- package/dist/assertions/runtime.cjs +207 -14
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/assertions/runtime.d.cts +9 -0
- package/dist/assertions/runtime.d.mts +9 -0
- package/dist/assertions/runtime.d.ts +9 -0
- package/dist/assertions/runtime.js +14 -8
- package/dist/assertions/score-match-audit.cjs +18 -8
- package/dist/assertions/score-match-audit.cjs.map +1 -1
- package/dist/assertions/score-match-gateway.cjs +83 -25
- package/dist/assertions/score-match-gateway.cjs.map +1 -1
- package/dist/assertions/score-match-gateway.d.cts +2 -0
- package/dist/assertions/score-match-gateway.d.mts +2 -0
- package/dist/assertions/score-match-gateway.d.ts +2 -0
- package/dist/assertions/value-composition.test-d.cjs +77 -0
- package/dist/assertions/value-composition.test-d.cjs.map +1 -0
- package/dist/assertions/value-composition.test-d.d.cts +1 -0
- package/dist/assertions/value-composition.test-d.d.mts +1 -0
- package/dist/assertions/value-composition.test-d.d.ts +1 -0
- package/dist/assertions/value-composition.test-d.js +4 -0
- package/dist/assertions/value-composition.test-d.js.map +1 -0
- package/dist/context/assert-first.cjs +207 -213
- package/dist/context/assert-first.cjs.map +1 -1
- package/dist/context/assert-first.d.cts +49 -23
- package/dist/context/assert-first.d.mts +49 -23
- package/dist/context/assert-first.d.ts +49 -23
- package/dist/context/session.cjs +111 -9
- package/dist/context/session.cjs.map +1 -1
- package/dist/context/session.d.cts +18 -0
- package/dist/context/session.d.mts +18 -0
- package/dist/context/session.d.ts +18 -0
- package/dist/define.cjs +17 -1
- package/dist/define.cjs.map +1 -1
- package/dist/eval/cli/contribution.cjs +2 -0
- package/dist/eval/cli/contribution.cjs.map +1 -1
- package/dist/eval/host/index.cjs +2 -0
- package/dist/eval/host/index.cjs.map +1 -1
- package/dist/eval/record/evaluation.cjs +3 -0
- package/dist/eval/record/evaluation.cjs.map +1 -1
- package/dist/eval/record/membership-provenance.d.cts +15 -15
- package/dist/eval/record/membership-provenance.d.mts +15 -15
- package/dist/eval/record/membership-provenance.d.ts +15 -15
- package/dist/eval/record/score.cjs +7 -0
- package/dist/eval/record/score.cjs.map +1 -1
- package/dist/eval/record/sealed-assertion.cjs +3 -0
- package/dist/eval/record/sealed-assertion.cjs.map +1 -1
- package/dist/eval/record/verdict.cjs +7 -0
- package/dist/eval/record/verdict.cjs.map +1 -1
- package/dist/expect/index.cjs +8 -2
- package/dist/expect/index.cjs.map +1 -1
- package/dist/expect/index.d.cts +9 -4
- package/dist/expect/index.d.mts +9 -4
- package/dist/expect/index.d.ts +9 -4
- package/dist/expect/index.js +72 -62
- package/dist/expect/index.mjs +72 -62
- package/dist/experiment/host/cli/contribution.cjs +37 -23
- package/dist/experiment/host/cli/contribution.cjs.map +1 -1
- package/dist/experiment/host/cli/contribution.d.cts +9 -1
- package/dist/experiment/host/cli/contribution.d.mts +9 -1
- package/dist/experiment/host/cli/contribution.d.ts +9 -1
- package/dist/experiment/host/current.cjs +74 -0
- package/dist/experiment/host/current.cjs.map +1 -0
- package/dist/experiment/host/current.d.cts +33 -0
- package/dist/experiment/host/current.d.mts +33 -0
- package/dist/experiment/host/current.d.ts +33 -0
- package/dist/experiment/host/current.js +10 -0
- package/dist/experiment/host/current.js.map +1 -0
- package/dist/experiment/host/index.cjs +17 -174
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +8 -54
- package/dist/experiment/host/index.d.mts +8 -54
- package/dist/experiment/host/index.d.ts +8 -54
- package/dist/experiment/host/operations.cjs +33 -10
- package/dist/experiment/host/operations.cjs.map +1 -1
- package/dist/experiment/host/operations.d.cts +29 -1
- package/dist/experiment/host/operations.d.mts +29 -1
- package/dist/experiment/host/operations.d.ts +29 -1
- package/dist/experiment/host/operations.js +6 -4
- package/dist/experiment/host/requirements.cjs +3 -0
- package/dist/experiment/host/requirements.cjs.map +1 -0
- package/dist/experiment/host/requirements.d.cts +3 -0
- package/dist/experiment/host/requirements.d.mts +3 -0
- package/dist/experiment/host/requirements.d.ts +3 -0
- package/dist/experiment/host/requirements.js +4 -0
- package/dist/experiment/host/requirements.js.map +1 -0
- package/dist/experiment/host/runtime.cjs +179 -0
- package/dist/experiment/host/runtime.cjs.map +1 -0
- package/dist/experiment/host/runtime.d.cts +79 -0
- package/dist/experiment/host/runtime.d.mts +79 -0
- package/dist/experiment/host/runtime.d.ts +79 -0
- package/dist/experiment/host/runtime.js +6 -0
- package/dist/experiment/host/runtime.js.map +1 -0
- package/dist/experiment/host/types.cjs.map +1 -1
- package/dist/experiment/host/types.d.cts +17 -16
- package/dist/experiment/host/types.d.mts +17 -16
- package/dist/experiment/host/types.d.ts +17 -16
- package/dist/fresh-import.cjs +2 -1
- package/dist/fresh-import.cjs.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -6
- package/dist/index.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +32 -30
- package/dist/index.mjs +32 -30
- package/dist/inspection/artifacts.cjs +83 -54
- package/dist/inspection/artifacts.cjs.map +1 -1
- package/dist/inspection/artifacts.d.cts +8 -0
- package/dist/inspection/artifacts.d.mts +8 -0
- package/dist/inspection/artifacts.d.ts +8 -0
- package/dist/inspection/artifacts.js +2 -0
- package/dist/inspection/assertions.cjs +4 -1
- package/dist/inspection/assertions.cjs.map +1 -1
- package/dist/inspection/cli/contribution.cjs +27 -4
- package/dist/inspection/cli/contribution.cjs.map +1 -1
- package/dist/inspection/cli/contribution.d.cts +2 -1
- package/dist/inspection/cli/contribution.d.mts +2 -1
- package/dist/inspection/cli/contribution.d.ts +2 -1
- package/dist/inspection/execution-traces.cjs +114 -8
- package/dist/inspection/execution-traces.cjs.map +1 -1
- package/dist/inspection/execution-traces.d.cts +38 -0
- package/dist/inspection/execution-traces.d.mts +38 -0
- package/dist/inspection/execution-traces.d.ts +38 -0
- package/dist/inspection/facts.cjs +12 -0
- package/dist/inspection/facts.cjs.map +1 -1
- package/dist/inspection/limits.cjs +5 -1
- package/dist/inspection/limits.cjs.map +1 -1
- package/dist/inspection/limits.d.cts +4 -0
- package/dist/inspection/limits.d.mts +4 -0
- package/dist/inspection/limits.d.ts +4 -0
- package/dist/inspection/limits.js +6 -2
- package/dist/inspection/overview.cjs +74 -33
- package/dist/inspection/overview.cjs.map +1 -1
- package/dist/inspection/overview.d.cts +19 -1
- package/dist/inspection/overview.d.mts +19 -1
- package/dist/inspection/overview.d.ts +19 -1
- package/dist/inspection/overview.js +4 -2
- package/dist/inspection/project-input.cjs +9 -0
- package/dist/inspection/project-input.cjs.map +1 -0
- package/dist/inspection/project-input.d.cts +20 -0
- package/dist/inspection/project-input.d.mts +20 -0
- package/dist/inspection/project-input.d.ts +20 -0
- package/dist/inspection/project-input.js +8 -0
- package/dist/inspection/project-input.js.map +1 -0
- package/dist/inspection/project-result.cjs +60 -0
- package/dist/inspection/project-result.cjs.map +1 -0
- package/dist/inspection/project-result.d.cts +1264 -0
- package/dist/inspection/project-result.d.mts +1264 -0
- package/dist/inspection/project-result.d.ts +1264 -0
- package/dist/inspection/project-result.js +10 -0
- package/dist/inspection/project-result.js.map +1 -0
- package/dist/inspection/project-source.cjs +109 -0
- package/dist/inspection/project-source.cjs.map +1 -0
- package/dist/inspection/project-source.d.cts +10 -0
- package/dist/inspection/project-source.d.mts +10 -0
- package/dist/inspection/project-source.d.ts +10 -0
- package/dist/inspection/project-source.js +6 -0
- package/dist/inspection/project-source.js.map +1 -0
- package/dist/inspection/project.cjs +100 -0
- package/dist/inspection/project.cjs.map +1 -0
- package/dist/inspection/project.d.cts +3 -0
- package/dist/inspection/project.d.mts +3 -0
- package/dist/inspection/project.d.ts +3 -0
- package/dist/inspection/project.js +6 -0
- package/dist/inspection/project.js.map +1 -0
- package/dist/inspection/protocol.cjs +19 -9
- package/dist/inspection/protocol.cjs.map +1 -1
- package/dist/inspection/protocol.d.cts +5506 -38189
- package/dist/inspection/protocol.d.mts +5506 -38189
- package/dist/inspection/protocol.d.ts +5506 -38189
- package/dist/inspection/public.mjs +896 -84
- package/dist/inspection/query.cjs +2 -0
- package/dist/inspection/query.cjs.map +1 -1
- package/dist/inspection/results.cjs +234 -29
- package/dist/inspection/results.cjs.map +1 -1
- package/dist/inspection/results.d.cts +870 -13
- package/dist/inspection/results.d.mts +870 -13
- package/dist/inspection/results.d.ts +870 -13
- package/dist/inspection/results.js +36 -34
- package/dist/inspection/select.cjs +126 -14
- package/dist/inspection/select.cjs.map +1 -1
- package/dist/inspection/select.d.cts +1 -1
- package/dist/inspection/select.d.mts +1 -1
- package/dist/inspection/select.d.ts +1 -1
- package/dist/inspection/source.cjs +4 -0
- package/dist/inspection/source.cjs.map +1 -1
- package/dist/inspection/sources.cjs +5 -0
- package/dist/inspection/sources.cjs.map +1 -1
- package/dist/inspection/trace.cjs +82 -84
- package/dist/inspection/trace.cjs.map +1 -1
- package/dist/inspection/trace.d.cts +7 -2
- package/dist/inspection/trace.d.mts +7 -2
- package/dist/inspection/trace.d.ts +7 -2
- package/dist/model-slots.cjs +35 -0
- package/dist/model-slots.cjs.map +1 -0
- package/dist/model-slots.d.cts +19 -0
- package/dist/model-slots.d.mts +19 -0
- package/dist/model-slots.d.ts +19 -0
- package/dist/model-slots.js +8 -0
- package/dist/model-slots.js.map +1 -0
- package/dist/o11y/adapter-call-price.cjs +4 -0
- package/dist/o11y/adapter-call-price.cjs.map +1 -1
- package/dist/o11y/adapter-call-price.d.cts +24 -0
- package/dist/o11y/adapter-call-price.d.mts +24 -0
- package/dist/o11y/adapter-call-price.d.ts +24 -0
- package/dist/o11y/adapter-call-price.js +6 -2
- package/dist/o11y/adapter-usage-projection.cjs +158 -0
- package/dist/o11y/adapter-usage-projection.cjs.map +1 -0
- package/dist/o11y/adapter-usage-projection.d.cts +141 -0
- package/dist/o11y/adapter-usage-projection.d.mts +141 -0
- package/dist/o11y/adapter-usage-projection.d.ts +141 -0
- package/dist/o11y/adapter-usage-projection.js +20 -0
- package/dist/o11y/adapter-usage-projection.js.map +1 -0
- package/dist/o11y/eval-usage.cjs +149 -0
- package/dist/o11y/eval-usage.cjs.map +1 -0
- package/dist/o11y/eval-usage.d.cts +46 -0
- package/dist/o11y/eval-usage.d.mts +46 -0
- package/dist/o11y/eval-usage.d.ts +46 -0
- package/dist/o11y/eval-usage.js +8 -0
- package/dist/o11y/eval-usage.js.map +1 -0
- package/dist/o11y/judge-call-price.cjs +62 -0
- package/dist/o11y/judge-call-price.cjs.map +1 -0
- package/dist/o11y/judge-call-price.d.cts +3 -0
- package/dist/o11y/judge-call-price.d.mts +3 -0
- package/dist/o11y/judge-call-price.d.ts +3 -0
- package/dist/o11y/judge-call-price.js +6 -0
- package/dist/o11y/judge-call-price.js.map +1 -0
- package/dist/o11y/judge-usage-projection.cjs +134 -0
- package/dist/o11y/judge-usage-projection.cjs.map +1 -0
- package/dist/o11y/judge-usage-projection.d.cts +18 -0
- package/dist/o11y/judge-usage-projection.d.mts +18 -0
- package/dist/o11y/judge-usage-projection.d.ts +18 -0
- package/dist/o11y/judge-usage-projection.js +20 -0
- package/dist/o11y/judge-usage-projection.js.map +1 -0
- package/dist/o11y/judge-usage-receipt.cjs +135 -0
- package/dist/o11y/judge-usage-receipt.cjs.map +1 -0
- package/dist/o11y/judge-usage-receipt.d.cts +5 -0
- package/dist/o11y/judge-usage-receipt.d.mts +5 -0
- package/dist/o11y/judge-usage-receipt.d.ts +5 -0
- package/dist/o11y/judge-usage-receipt.js +6 -0
- package/dist/o11y/judge-usage-receipt.js.map +1 -0
- package/dist/o11y/judge-usage.cjs +171 -0
- package/dist/o11y/judge-usage.cjs.map +1 -0
- package/dist/o11y/judge-usage.d.cts +35 -0
- package/dist/o11y/judge-usage.d.mts +35 -0
- package/dist/o11y/judge-usage.d.ts +35 -0
- package/dist/o11y/judge-usage.js +6 -0
- package/dist/o11y/judge-usage.js.map +1 -0
- package/dist/plugin/contracts.cjs +2 -0
- package/dist/plugin/contracts.cjs.map +1 -1
- package/dist/plugin/link.cjs +7 -0
- package/dist/plugin/link.cjs.map +1 -1
- package/dist/record/attachment/protocol.cjs +8 -6
- package/dist/record/attachment/protocol.cjs.map +1 -1
- package/dist/record/attachment/protocol.d.cts +10 -0
- package/dist/record/attachment/protocol.d.mts +10 -0
- package/dist/record/attachment/protocol.d.ts +10 -0
- package/dist/record/attachment/protocol.js +38 -36
- package/dist/record/codec/seal-manifest.d.cts +3 -3
- package/dist/record/codec/seal-manifest.d.mts +3 -3
- package/dist/record/codec/seal-manifest.d.ts +3 -3
- package/dist/record/family/adapter-usage/definition.d.cts +1 -0
- package/dist/record/family/adapter-usage/definition.d.mts +1 -0
- package/dist/record/family/adapter-usage/definition.d.ts +1 -0
- package/dist/record/family/adapter-usage/persistence.cjs +1 -1
- package/dist/record/family/adapter-usage/persistence.cjs.map +1 -1
- package/dist/record/family/adapter-usage/persistence.d.cts +2 -1
- package/dist/record/family/adapter-usage/persistence.d.mts +2 -1
- package/dist/record/family/adapter-usage/persistence.d.ts +2 -1
- package/dist/record/family/adapter-usage/schema.cjs +21 -2
- package/dist/record/family/adapter-usage/schema.cjs.map +1 -1
- package/dist/record/family/adapter-usage/schema.d.cts +85 -0
- package/dist/record/family/adapter-usage/schema.d.mts +85 -0
- package/dist/record/family/adapter-usage/schema.d.ts +85 -0
- package/dist/record/family/adapter-usage/schema.js +18 -12
- package/dist/record/family/catalog.cjs +31 -27
- package/dist/record/family/catalog.cjs.map +1 -1
- package/dist/record/family/catalog.d.cts +94 -3
- package/dist/record/family/catalog.d.mts +94 -3
- package/dist/record/family/catalog.d.ts +94 -3
- package/dist/record/family/current.cjs +45 -42
- package/dist/record/family/current.cjs.map +1 -1
- package/dist/record/family/current.d.cts +240 -1
- package/dist/record/family/current.d.mts +240 -1
- package/dist/record/family/current.d.ts +240 -1
- package/dist/record/family/execution-traces/definition.d.cts +26 -0
- package/dist/record/family/execution-traces/definition.d.mts +26 -0
- package/dist/record/family/execution-traces/definition.d.ts +26 -0
- package/dist/record/family/execution-traces/definition.js +20 -14
- package/dist/record/family/execution-traces/schema.cjs +57 -1
- package/dist/record/family/execution-traces/schema.cjs.map +1 -1
- package/dist/record/family/execution-traces/schema.d.cts +114 -0
- package/dist/record/family/execution-traces/schema.d.mts +114 -0
- package/dist/record/family/execution-traces/schema.d.ts +114 -0
- package/dist/record/family/execution-traces/schema.js +18 -12
- package/dist/record/family/judge-usage/definition.cjs +12 -0
- package/dist/record/family/judge-usage/definition.cjs.map +1 -0
- package/dist/record/family/judge-usage/definition.d.cts +91 -0
- package/dist/record/family/judge-usage/definition.d.mts +91 -0
- package/dist/record/family/judge-usage/definition.d.ts +91 -0
- package/dist/record/family/judge-usage/definition.js +6 -0
- package/dist/record/family/judge-usage/definition.js.map +1 -0
- package/dist/record/family/judge-usage/persistence.cjs +10 -0
- package/dist/record/family/judge-usage/persistence.cjs.map +1 -0
- package/dist/record/family/judge-usage/persistence.d.cts +91 -0
- package/dist/record/family/judge-usage/persistence.d.mts +91 -0
- package/dist/record/family/judge-usage/persistence.d.ts +91 -0
- package/dist/record/family/judge-usage/persistence.js +6 -0
- package/dist/record/family/judge-usage/persistence.js.map +1 -0
- package/dist/record/family/judge-usage/schema.cjs +307 -0
- package/dist/record/family/judge-usage/schema.cjs.map +1 -0
- package/dist/record/family/judge-usage/schema.d.cts +351 -0
- package/dist/record/family/judge-usage/schema.d.mts +351 -0
- package/dist/record/family/judge-usage/schema.d.ts +351 -0
- package/dist/record/family/judge-usage/schema.js +18 -0
- package/dist/record/family/judge-usage/schema.js.map +1 -0
- package/dist/record/host/sqlite-host.cjs +55 -9
- package/dist/record/host/sqlite-host.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +7 -0
- package/dist/record/host/types.d.mts +7 -0
- package/dist/record/host/types.d.ts +7 -0
- package/dist/record/model/run-context.cjs +7 -1
- package/dist/record/model/run-context.cjs.map +1 -1
- package/dist/record/model/run-context.d.cts +4 -0
- package/dist/record/model/run-context.d.mts +4 -0
- package/dist/record/model/run-context.d.ts +4 -0
- package/dist/record/model/seal-manifest.d.cts +1 -1
- package/dist/record/model/seal-manifest.d.mts +1 -1
- package/dist/record/model/seal-manifest.d.ts +1 -1
- package/dist/record/sqlite/client.cjs +18 -5
- package/dist/record/sqlite/client.cjs.map +1 -1
- package/dist/record/sqlite/client.d.cts +1 -1
- package/dist/record/sqlite/client.d.mts +1 -1
- package/dist/record/sqlite/client.d.ts +1 -1
- package/dist/record/sqlite/project-state-database.cjs +29 -8
- package/dist/record/sqlite/project-state-database.cjs.map +1 -1
- package/dist/run/host/runtime.cjs +4 -0
- package/dist/run/host/runtime.cjs.map +1 -1
- package/dist/run/storage/sqlite.cjs +20 -0
- package/dist/run/storage/sqlite.cjs.map +1 -1
- package/dist/runner/adapter-execution-trace.cjs +125 -2
- package/dist/runner/adapter-execution-trace.cjs.map +1 -1
- package/dist/runner/adapter-execution-trace.d.cts +1 -1
- package/dist/runner/adapter-execution-trace.d.mts +1 -1
- package/dist/runner/adapter-execution-trace.d.ts +1 -1
- package/dist/runner/adapter-usage.cjs +55 -7
- package/dist/runner/adapter-usage.cjs.map +1 -1
- package/dist/runner/adapter-usage.d.cts +9 -2
- package/dist/runner/adapter-usage.d.mts +9 -2
- package/dist/runner/adapter-usage.d.ts +9 -2
- package/dist/runner/adoption.cjs +9 -0
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt-cancellation.cjs +12 -0
- package/dist/runner/attempt-cancellation.cjs.map +1 -0
- package/dist/runner/attempt-cancellation.d.cts +6 -0
- package/dist/runner/attempt-cancellation.d.mts +6 -0
- package/dist/runner/attempt-cancellation.d.ts +6 -0
- package/dist/runner/attempt-cancellation.js +6 -0
- package/dist/runner/attempt-cancellation.js.map +1 -0
- package/dist/runner/attempt-resources.cjs +10 -4
- package/dist/runner/attempt-resources.cjs.map +1 -1
- package/dist/runner/attempt-resources.d.cts +2 -1
- package/dist/runner/attempt-resources.d.mts +2 -1
- package/dist/runner/attempt-resources.d.ts +2 -1
- package/dist/runner/attempt.cjs +1177 -1139
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/config-identity.cjs +20 -1
- package/dist/runner/config-identity.cjs.map +1 -1
- package/dist/runner/config-identity.d.cts +5 -0
- package/dist/runner/config-identity.d.mts +5 -0
- package/dist/runner/config-identity.d.ts +5 -0
- package/dist/runner/discover.cjs +14 -0
- package/dist/runner/discover.cjs.map +1 -1
- package/dist/runner/discover.d.cts +3 -0
- package/dist/runner/discover.d.mts +3 -0
- package/dist/runner/discover.d.ts +3 -0
- package/dist/runner/feedback/human.cjs +9 -4
- package/dist/runner/feedback/human.cjs.map +1 -1
- package/dist/runner/fingerprint.cjs +1 -0
- package/dist/runner/fingerprint.cjs.map +1 -1
- package/dist/runner/judge-usage.cjs +18 -0
- package/dist/runner/judge-usage.cjs.map +1 -0
- package/dist/runner/judge-usage.d.cts +5 -0
- package/dist/runner/judge-usage.d.mts +5 -0
- package/dist/runner/judge-usage.d.ts +5 -0
- package/dist/runner/judge-usage.js +8 -0
- package/dist/runner/judge-usage.js.map +1 -0
- package/dist/runner/project-target.cjs.map +1 -1
- package/dist/runner/project-target.d.cts +2 -0
- package/dist/runner/project-target.d.mts +2 -0
- package/dist/runner/project-target.d.ts +2 -0
- package/dist/runner/record/planning.cjs +1 -0
- package/dist/runner/record/planning.cjs.map +1 -1
- package/dist/runner/record.cjs +4 -0
- package/dist/runner/record.cjs.map +1 -1
- package/dist/runner/reporters/braintrust.cjs +2 -0
- package/dist/runner/reporters/braintrust.cjs.map +1 -1
- package/dist/runner/reuse-diagnostics.cjs +9 -10
- package/dist/runner/reuse-diagnostics.cjs.map +1 -1
- package/dist/runner/reuse-diagnostics.d.cts +5 -6
- package/dist/runner/reuse-diagnostics.d.mts +5 -6
- package/dist/runner/reuse-diagnostics.d.ts +5 -6
- package/dist/runner/reuse-diagnostics.js +4 -4
- package/dist/runner/reuse-plan.cjs +100 -48
- package/dist/runner/reuse-plan.cjs.map +1 -1
- package/dist/runner/reuse-plan.d.cts +60 -3
- package/dist/runner/reuse-plan.d.mts +60 -3
- package/dist/runner/reuse-plan.d.ts +60 -3
- package/dist/runner/reuse-plan.js +14 -10
- package/dist/runner/run.cjs +8 -6
- package/dist/runner/run.cjs.map +1 -1
- package/dist/runner/session.cjs +1 -1
- package/dist/runner/session.cjs.map +1 -1
- package/dist/runner/session.d.cts +1 -1
- package/dist/runner/session.d.mts +1 -1
- package/dist/runner/session.d.ts +1 -1
- package/dist/runner/source-producer.cjs +3 -1
- package/dist/runner/source-producer.cjs.map +1 -1
- package/dist/runner/types.cjs.map +1 -1
- package/dist/runner/types.d.cts +26 -5
- package/dist/runner/types.d.mts +26 -5
- package/dist/runner/types.d.ts +26 -5
- package/dist/sandbox/action.cjs +3 -0
- package/dist/sandbox/action.cjs.map +1 -1
- package/dist/sandbox/commands.cjs +3 -0
- package/dist/sandbox/commands.cjs.map +1 -1
- package/dist/sandbox/compose.cjs +6 -0
- package/dist/sandbox/compose.cjs.map +1 -1
- package/dist/sandbox/docker-profile/registry.cjs +7 -0
- package/dist/sandbox/docker-profile/registry.cjs.map +1 -1
- package/dist/sandbox/docker-profile/runtime.cjs +3 -0
- package/dist/sandbox/docker-profile/runtime.cjs.map +1 -1
- package/dist/sandbox/docker-profile/schema.cjs +7 -0
- package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
- package/dist/sandbox/incus.cjs +7 -0
- package/dist/sandbox/incus.cjs.map +1 -1
- package/dist/sandbox/layer.cjs +12 -0
- package/dist/sandbox/layer.cjs.map +1 -1
- package/dist/shared/adapter-cleanup.cjs +18 -0
- package/dist/shared/adapter-cleanup.cjs.map +1 -0
- package/dist/shared/adapter-cleanup.d.cts +4 -0
- package/dist/shared/adapter-cleanup.d.mts +4 -0
- package/dist/shared/adapter-cleanup.d.ts +4 -0
- package/dist/shared/adapter-cleanup.js +10 -0
- package/dist/shared/adapter-cleanup.js.map +1 -0
- package/dist/shared/attempt-lifecycle.cjs +3 -0
- package/dist/shared/attempt-lifecycle.cjs.map +1 -0
- package/dist/shared/attempt-lifecycle.d.cts +13 -0
- package/dist/shared/attempt-lifecycle.d.mts +13 -0
- package/dist/shared/attempt-lifecycle.d.ts +13 -0
- package/dist/shared/attempt-lifecycle.js +4 -0
- package/dist/shared/attempt-lifecycle.js.map +1 -0
- package/dist/show/contribution.cjs +52 -14
- package/dist/show/contribution.cjs.map +1 -1
- package/dist/show/contribution.d.cts +23 -1
- package/dist/show/contribution.d.mts +23 -1
- package/dist/show/contribution.d.ts +23 -1
- package/dist/show/model.cjs +8 -1
- package/dist/show/model.cjs.map +1 -1
- package/dist/show/model.d.cts +10 -1
- package/dist/show/model.d.mts +10 -1
- package/dist/show/model.d.ts +10 -1
- package/dist/show/render.cjs +287 -49
- package/dist/show/render.cjs.map +1 -1
- package/dist/show/render.d.cts +3 -0
- package/dist/show/render.d.mts +3 -0
- package/dist/show/render.d.ts +3 -0
- package/dist/sources/projector.cjs +3 -0
- package/dist/sources/projector.cjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/view/app-dist/.vite/manifest.json +2 -2
- package/dist/view/app-dist/assets/index-CmVoXbwG.js +63 -0
- package/dist/view/app-dist/assets/{quality-cost-scatter-CFB3wnkN.js → quality-cost-scatter-BuLISaH4.js} +1 -1
- package/dist/view/app-dist/index.html +1 -1
- package/dist/view/cli/contribution.cjs +54 -21
- package/dist/view/cli/contribution.cjs.map +1 -1
- package/dist/view/cli/contribution.d.cts +2 -1
- package/dist/view/cli/contribution.d.mts +2 -1
- package/dist/view/cli/contribution.d.ts +2 -1
- package/dist/view/function-runtime.mjs +13231 -11647
- package/dist/view/http-protocol.cjs +3 -0
- package/dist/view/http-protocol.cjs.map +1 -1
- package/dist/view/http-protocol.d.cts +8 -0
- package/dist/view/http-protocol.d.mts +8 -0
- package/dist/view/http-protocol.d.ts +8 -0
- package/dist/view/inspection-host.cjs +17 -1
- package/dist/view/inspection-host.cjs.map +1 -1
- package/dist/view/render.cjs +1 -0
- package/dist/view/render.cjs.map +1 -1
- package/dist/view/render.d.cts +2 -1
- package/dist/view/render.d.mts +2 -1
- package/dist/view/render.d.ts +2 -1
- package/dist/view/revision.cjs.map +1 -1
- package/dist/view/revision.d.cts +12 -0
- package/dist/view/revision.d.mts +12 -0
- package/dist/view/revision.d.ts +12 -0
- package/dist/view/server.cjs +10 -9
- package/dist/view/server.cjs.map +1 -1
- package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
- package/docs-site/zh/explanation/adapter.mdx +2 -2
- package/docs-site/zh/explanation/assert.mdx +60 -24
- package/docs-site/zh/explanation/drive.mdx +1 -1
- package/docs-site/zh/explanation/evals.mdx +31 -29
- package/docs-site/zh/explanation/experiment.mdx +15 -15
- package/docs-site/zh/explanation/judge.mdx +23 -15
- package/docs-site/zh/explanation/overview.mdx +44 -21
- package/docs-site/zh/explanation/record.mdx +28 -13
- package/docs-site/zh/explanation/results-flow.mdx +37 -0
- package/docs-site/zh/explanation/runner.mdx +27 -6
- package/docs-site/zh/index.mdx +22 -115
- package/docs-site/zh/introduction.mdx +89 -61
- package/docs-site/zh/reference/cli.mdx +50 -26
- package/docs-site/zh/reference/define-agent.mdx +37 -5
- package/docs-site/zh/reference/define-eval.mdx +130 -29
- package/docs-site/zh/reference/define-experiment.mdx +251 -0
- package/docs-site/zh/reference/events.mdx +34 -30
- package/docs-site/zh/reference/expect.mdx +77 -2
- package/docs-site/zh/reference/official-adapters.mdx +2 -2
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +43 -24
- package/docs-site/zh/troubleshooting/debugging.mdx +65 -42
- package/docs-site/zh/troubleshooting/recover-after-kill.mdx +35 -28
- package/docs-site/zh/tutorials/accept-results.mdx +34 -24
- package/docs-site/zh/tutorials/agent-feedback-loop.mdx +74 -43
- package/docs-site/zh/tutorials/agent-onboarding.mdx +27 -20
- package/docs-site/zh/tutorials/authoring.mdx +138 -121
- package/docs-site/zh/tutorials/ci-integration.mdx +46 -22
- package/docs-site/zh/tutorials/compare-runs.mdx +40 -13
- package/docs-site/zh/tutorials/concurrency.mdx +66 -62
- package/docs-site/zh/tutorials/configuration.mdx +17 -17
- package/docs-site/zh/tutorials/connect-otel.mdx +48 -37
- package/docs-site/zh/tutorials/connect-your-agent.mdx +80 -173
- package/docs-site/zh/tutorials/control-run-cost.mdx +63 -12
- package/docs-site/zh/tutorials/criteria-files.mdx +28 -21
- package/docs-site/zh/tutorials/custom-application.mdx +75 -55
- package/docs-site/zh/tutorials/dataset-fanout.mdx +32 -22
- package/docs-site/zh/tutorials/debug-lifecycle-plan.mdx +38 -31
- package/docs-site/zh/tutorials/docker-in-docker.mdx +83 -89
- package/docs-site/zh/tutorials/eval-groups.mdx +70 -89
- package/docs-site/zh/tutorials/evaluation-kinds.mdx +12 -5
- package/docs-site/zh/tutorials/experiment-services.mdx +243 -0
- package/docs-site/zh/tutorials/fixtures.mdx +42 -26
- package/docs-site/zh/tutorials/handle-execution-failures.mdx +41 -19
- package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +21 -16
- package/docs-site/zh/tutorials/niceeval-taste-application.mdx +394 -0
- package/docs-site/zh/tutorials/niceeval-taste.mdx +190 -0
- package/docs-site/zh/tutorials/nixos-managed-dind.mdx +51 -39
- package/docs-site/zh/tutorials/plugins.mdx +55 -31
- package/docs-site/zh/tutorials/prebuilt-sandbox.mdx +204 -0
- package/docs-site/zh/tutorials/quickstart.mdx +91 -47
- package/docs-site/zh/tutorials/reporters.mdx +45 -30
- package/docs-site/zh/tutorials/rerun-and-cache.mdx +39 -40
- package/docs-site/zh/tutorials/sandbox-agent.mdx +65 -40
- package/docs-site/zh/tutorials/sandbox-providers.mdx +104 -282
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +65 -97
- package/docs-site/zh/tutorials/select-and-preview.mdx +25 -20
- package/docs-site/zh/tutorials/verify-judge.mdx +49 -26
- package/docs-site/zh/tutorials/viewing-results.mdx +130 -80
- package/docs-site/zh/tutorials/write-experiment.mdx +116 -298
- package/docs-site/zh/tutorials/write-send.mdx +53 -52
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +1 -1
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -2
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +38 -14
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/webidl.d.ts +13 -7
- package/package.json +4 -4
- package/dist/view/app-dist/assets/index-DFzw1L97.js +0 -63
- package/docs-site/zh/tutorials/experiments.mdx +0 -101
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
sidebarTitle: "
|
|
4
|
-
description: "
|
|
2
|
+
title: "编写实验:比较模型、prompt 和 Agent"
|
|
3
|
+
sidebarTitle: "编写实验"
|
|
4
|
+
description: "用 defineExperiment 固定被测 Agent、模型、flags 和运行次数。同一批评估用例写两份只差一个变量的 Experiment,就能比较两个模型或两版 prompt。"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
你写了一版新的 system prompt,想知道它比旧版好还是差。评估用例已经有了,现在需要对着两个版本各跑一遍,再把结果放在一起看。
|
|
8
|
+
|
|
9
|
+
这就是 Experiment 的用处。评估用例只说“发什么、怎样算做对”;Experiment 说“对着谁跑”:哪个 Agent、哪个模型、开哪些 flags、跑几次、花多少钱为止。两者分开,同一批评估用例就能拿来比较任意两个配置。
|
|
8
10
|
|
|
9
11
|
## 最小实验
|
|
10
12
|
|
|
@@ -18,383 +20,199 @@ export default defineExperiment({
|
|
|
18
20
|
});
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
`agent` 放的是已经配置好的
|
|
23
|
+
文件路径就是 Experiment ID,这里是 `local`。`agent` 放的是已经配置好的 Adapter 实例,被测应用的地址、鉴权这类连接参数传给 Adapter 工厂,不写在别处。
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm exec niceeval exp local
|
|
27
|
+
```
|
|
22
28
|
|
|
23
|
-
##
|
|
24
|
-
|
|
29
|
+
## 比较两个模型
|
|
30
|
+
|
|
31
|
+
一个 Experiment 文件就是一个配置。要比较两个模型,写两个文件,只改 `model` 那一行:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
experiments/
|
|
35
|
+
models/gpt-5.4.ts
|
|
36
|
+
models/deepseek-v4-pro.ts
|
|
37
|
+
```
|
|
25
38
|
|
|
26
39
|
```ts
|
|
27
|
-
// experiments/
|
|
40
|
+
// experiments/models/gpt-5.4.ts
|
|
28
41
|
import { defineExperiment } from "niceeval";
|
|
29
42
|
import { webAgent } from "../../agents/web-agent.ts";
|
|
30
43
|
|
|
31
44
|
export default defineExperiment({
|
|
32
|
-
description: "
|
|
33
|
-
agent: webAgent({
|
|
34
|
-
baseUrl: "https://staging.example.com",
|
|
35
|
-
}),
|
|
45
|
+
description: "gpt-5.4",
|
|
46
|
+
agent: webAgent({ baseUrl: "http://127.0.0.1:5188" }),
|
|
36
47
|
model: "gpt-5.4",
|
|
37
|
-
|
|
38
|
-
promptVariant: "v1", // ← 唯一的变量
|
|
39
|
-
},
|
|
40
|
-
attempts: 1,
|
|
41
|
-
budget: 5,
|
|
48
|
+
attempts: 3,
|
|
42
49
|
});
|
|
43
50
|
```
|
|
44
51
|
|
|
52
|
+
`model` 会作为 `ctx.model` 传给 Adapter。Adapter 要把它放进发给应用的请求里,应用才真的会换模型,写法见[接入你的 Agent](/zh/tutorials/connect-your-agent)。
|
|
53
|
+
|
|
54
|
+
`attempts: 3` 让每条评估用例跑 3 次。Agent 每次的回答都不一样,只跑一次的通过率说明不了多少问题。
|
|
55
|
+
|
|
56
|
+
## 比较两版 prompt
|
|
57
|
+
|
|
58
|
+
prompt 版本在应用内部,NiceEval 看不到。做法和产品里的 A/B 测试一样:应用接受一个 flag,按 flag 切换 prompt;Experiment 负责给这个 flag 赋值。
|
|
59
|
+
|
|
45
60
|
```ts
|
|
46
|
-
// experiments/prompts/
|
|
61
|
+
// experiments/prompts/v1.ts
|
|
47
62
|
import { defineExperiment } from "niceeval";
|
|
48
63
|
import { webAgent } from "../../agents/web-agent.ts";
|
|
49
64
|
|
|
50
65
|
export default defineExperiment({
|
|
51
|
-
description: "System Prompt
|
|
52
|
-
agent: webAgent({
|
|
53
|
-
baseUrl: "https://staging.example.com",
|
|
54
|
-
}),
|
|
66
|
+
description: "System Prompt v1(基线)",
|
|
67
|
+
agent: webAgent({ baseUrl: "https://staging.example.com" }),
|
|
55
68
|
model: "gpt-5.4",
|
|
56
|
-
flags: {
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
attempts: 1,
|
|
69
|
+
flags: { promptVariant: "v1" }, // 两个文件只有这里不同
|
|
70
|
+
attempts: 3,
|
|
60
71
|
budget: 5,
|
|
61
72
|
});
|
|
62
73
|
```
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`model` 会作为 `ctx.model` 传给 Adapter。如果你的 Agent 支持模型选择,自己构建请求
|
|
75
|
+
`experiments/prompts/v2.ts` 把 `promptVariant` 改成 `"v2"`,其余逐字相同。两个配置之间差得越少,分数的差别就越能归因到 prompt 上。
|
|
68
76
|
|
|
69
|
-
`flags`
|
|
70
|
-
不接受嵌套对象、数组、`null` 或显式 `undefined`;省略整个 `flags` 等价于 `{}`。
|
|
71
|
-
NiceEval 在启动前检查结构、复制并冻结,再作为 `ctx.flags` 传给 Adapter、作为 `t.flags` 传给评估用例。
|
|
72
|
-
普通 Adapter 可声明同步 `parseFlags(input: unknown)` 检查策略名、补默认值或规范化值;返回值也必须满足相同结构。
|
|
73
|
-
实验的 `flags` 类型由该返回类型推导,规范化后的值参与缓存身份。
|
|
74
|
-
|
|
75
|
-
语义就是产品 A/B 测试里的 feature flag,应该编写 Adapter 把 Flag 发给你的 Agent,Agent 根据 Flag 切换不同的 System Prompt 或者行为。
|
|
77
|
+
Adapter 把 `ctx.flags` 原样转给应用:
|
|
76
78
|
|
|
77
79
|
```ts
|
|
78
80
|
// agents/web-agent.ts
|
|
79
81
|
async send(input, ctx) {
|
|
80
|
-
await fetch(`${baseUrl}/api/turn`, {
|
|
82
|
+
const r = await fetch(`${baseUrl}/api/turn`, {
|
|
81
83
|
method: "POST",
|
|
82
84
|
headers: { "content-type": "application/json" },
|
|
83
|
-
body: JSON.stringify({
|
|
84
|
-
message: input.text,
|
|
85
|
-
model: ctx.model,
|
|
86
|
-
flags: ctx.flags,
|
|
87
|
-
}),
|
|
85
|
+
body: JSON.stringify({ message: input.text, model: ctx.model, flags: ctx.flags }),
|
|
88
86
|
signal: ctx.signal,
|
|
89
87
|
});
|
|
88
|
+
// ……把回复翻译成 events
|
|
90
89
|
}
|
|
91
90
|
```
|
|
92
91
|
|
|
93
|
-
|
|
92
|
+
`flags` 是扁平对象,值只能是字符串、有限数字或布尔值。嵌套对象、数组、`null` 和显式 `undefined` 都会在运行前被拒绝。评估用例里也能用 `t.flags` 读到同一份值。
|
|
94
93
|
|
|
95
|
-
|
|
94
|
+
需要检查 flag 是否合法或补默认值时,在 Adapter 上声明同步的 `parseFlags(input: unknown)`。它的返回值决定实验里 `flags` 的类型,规范化后的值参与结果沿用的判定。
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
experiments/
|
|
99
|
-
prompts/baseline.ts
|
|
100
|
-
prompts/concise.ts
|
|
101
|
-
retrieval/with-retrieval.ts
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
npx niceeval exp prompts
|
|
106
|
-
```
|
|
96
|
+
最常见的失误是两个文件写成了同一个 `flags` 或同一个 `model`,例如两边都读同一个环境变量的默认值。运行和报告都正常,但两列数字比的是同一套配置。
|
|
107
97
|
|
|
108
|
-
|
|
98
|
+
## 跑一组,或者只跑一格
|
|
109
99
|
|
|
110
|
-
|
|
100
|
+
位置参数按 ID 前缀选择 Experiment。目录只用来组织 ID 和批量选择:
|
|
111
101
|
|
|
112
102
|
```bash
|
|
113
|
-
|
|
103
|
+
pnpm exec niceeval exp prompts # prompts/ 下全部实验
|
|
104
|
+
pnpm exec niceeval exp prompts/v2 # 只跑 v2 这一格
|
|
114
105
|
```
|
|
115
106
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## 常用字段
|
|
119
|
-
|
|
120
|
-
| 字段 | 用途 |
|
|
121
|
-
|---|---|
|
|
122
|
-
| `agent` | 选择并配置 adapter。必填 |
|
|
123
|
-
| `model` | 单个模型名,经 `ctx.model` 透传 |
|
|
124
|
-
| `reasoningEffort` | 单个推理努力程度(如 `"high"`),经 `ctx.reasoningEffort` / `t.reasoningEffort` 透传,归属与 `model` 一致 |
|
|
125
|
-
| `flags` | 实验条件(A/B 里的 feature flag),扁平对象,值为字符串、有限数字或布尔值,经 `ctx.flags` / `t.flags` 透传 |
|
|
126
|
-
| `attempts` | 每个评估用例 × 配置最多跑几次 |
|
|
127
|
-
| `earlyExit` | 多次运行里通过一次就提前停止。默认关,`attempts` 默认跑满测完整通过率 |
|
|
128
|
-
| `evals` | `"*"`、ID 前缀数组,或遍历只读评估用例描述并返回 Boolean 的函数 |
|
|
129
|
-
| `timeoutMs` | 单个 attempt 的超时 |
|
|
130
|
-
| `budget` | 这一格配置的预算上限 |
|
|
131
|
-
| `maxConcurrency` | 这一格配置的并发上限 |
|
|
132
|
-
| `sharedState` | 跨 Invocation 共享 checkpoint 的独占 key。只协调状态,不提供存储 |
|
|
133
|
-
| `sandbox` | 一条 `SandboxLayer`。具体 factory 声明唯一 Provider template,并可链 `.before()` / `.after()` |
|
|
134
|
-
| `plugins` | 显式附着的 NiceEval Plugin occurrence;把一套 identity、flags、Sandbox 命令、生命周期或 Agent Extension 作为完整条件复用 |
|
|
135
|
-
| `setup` | 实验级 Hook:整个实验只跑一次、在你自己的机器上执行,启动全部 Attempt 共享的服务(见下) |
|
|
136
|
-
| `teardown` | 与 `setup` 成对的实验级 Hook:全部 Attempt 收尾后执行一次,当且仅当 `setup` 的时点已经走到(见下) |
|
|
137
|
-
|
|
138
|
-
## 传递运行时地址,又不让它作废缓存
|
|
139
|
-
|
|
140
|
-
`flags` 写的是实验条件,它整袋参与缓存判定:值一变,已经跑完的结果就要重跑。所以隧道地址不要写进 `flags`——隧道每次重启换一个 URL,写进去就等于每次重启都作废全部已完成结果。
|
|
141
|
-
|
|
142
|
-
这个地址是 `setup` 跑起来才拿到的。把它留在生命周期闭包里,再由 Agent 工厂或 Sandbox callback 使用;它不是实验条件,也没有通用 API 把它写成报告字段:
|
|
143
|
-
|
|
144
|
-
```ts
|
|
145
|
-
let endpoint: string | undefined;
|
|
146
|
-
|
|
147
|
-
export default defineExperiment({
|
|
148
|
-
agent: nowledgeAgent(() => ({ url: endpoint! })),
|
|
149
|
-
sandbox: e2bSandbox({ template: "niceeval-agents" })
|
|
150
|
-
.before(async sandbox => {
|
|
151
|
-
await sandbox.writeText(".nowledge/env", `NMEM_URL=${endpoint!}\n`);
|
|
152
|
-
}),
|
|
153
|
-
async setup(ctx) {
|
|
154
|
-
endpoint = (await nowledgeTunnel({ signal: ctx.signal })).url;
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
换了 URL 再跑,已完成的照常复用,只跑还缺的:
|
|
107
|
+
某一格结果反常、需要单独复现时,写它的完整 ID 就行,不用先跑完整组,也不用把其它文件挪走。后面再跟评估用例 ID 前缀,可以进一步只跑某几道题:
|
|
160
108
|
|
|
161
109
|
```bash
|
|
162
|
-
|
|
163
|
-
╭─ PLAN ──────────────────────────────────────────╮
|
|
164
|
-
│ 36 attempts · 36 evals × 1 configs │
|
|
165
|
-
│ 24 of 36 reuse from cache · 12 to run │
|
|
166
|
-
╰─────────────────────────────────────────────────╯
|
|
110
|
+
pnpm exec niceeval exp prompts/v2 refund-policy
|
|
167
111
|
```
|
|
168
112
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
服务端版本号则相反:写成 `flags: { memoryVersion: "0.10.39" }`,换了版本行为可能真的不一样,那种变化就该让结果重跑。判据是**它是否是可比较的实验条件**:是就写 `flags`;只是本次连接坐标,就放在生命周期代码或外部服务配置里。没有通用回调、自定义数据族或注册点可把任意值写进结果。Adapter 和评估用例都不需要读、只给报告分组用的标注写 `labels`。
|
|
172
|
-
|
|
173
|
-
## 启动 Experiment 共享服务
|
|
113
|
+
想在运行前确认会跑哪些评估用例、多少次,加 `--dry`,见[选择并预览运行范围](/zh/tutorials/select-and-preview)。
|
|
174
114
|
|
|
175
|
-
|
|
115
|
+
## 看对比结果
|
|
176
116
|
|
|
177
|
-
|
|
178
|
-
// setup 拿到的地址、密钥放模块变量:teardown 和同文件里的 agent(每个 Attempt 都会执行、晚于 setup)直接读它。
|
|
179
|
-
let tunnel: { url: string; apiKey: string; stop(): Promise<void> };
|
|
117
|
+
两个配置都跑完后,在终端分别查看:
|
|
180
118
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
evals: ["memory/"],
|
|
184
|
-
async setup(ctx) {
|
|
185
|
-
ctx.progress({ message: "starting nowledge tunnel" });
|
|
186
|
-
tunnel = await nowledgeTunnel({ signal: ctx.signal });
|
|
187
|
-
},
|
|
188
|
-
async teardown(ctx) {
|
|
189
|
-
ctx.progress({ message: "stopping nowledge tunnel" });
|
|
190
|
-
await tunnel?.stop(); // setup 抛错也会走到这里:对可能未赋值的变量做防御
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
`setup` 在跑的时候,终端的 `ACTIVE` 区会显示一行 `experiment setup · <实验 id>`,`ctx.progress(...)` 的消息就更新在这一行末尾。等它的 Attempt 计入排队数,这不是卡住。在 CI 或 agent 输出里,`setup` / `teardown` 的开始和结束各追加一行。
|
|
196
|
-
|
|
197
|
-
`setup` 抛错时,这个实验的每条 Attempt 都记为 `errored`(错误码 `experiment-setup-failed`)、逐条进报告。同一批的其它实验照常跑——环境起不来不该伪装成绿,也不该连坐别人。
|
|
198
|
-
|
|
199
|
-
`teardown` 里资源释放是必达底线:用 `try/finally` 包住,不管前面的观测代码是否出错都要执行。观测类动作(health 检查、指标上报)只是 best-effort——给它自己的短超时、失败不要拦住释放,并在 `ctx.signal.aborted` 时直接跳过。中断路径上,一次可能挂起的观测不该挡在「拆隧道、退租约」前面:
|
|
200
|
-
|
|
201
|
-
```ts
|
|
202
|
-
async teardown(ctx) {
|
|
203
|
-
try {
|
|
204
|
-
if (!ctx.signal.aborted) {
|
|
205
|
-
await tunnel?.probe({ timeoutMs: 10_000 }).catch(() => {});
|
|
206
|
-
}
|
|
207
|
-
} finally {
|
|
208
|
-
await tunnel?.stop(); // 释放是必达底线,无论观测成败都要执行
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
`setup` / `teardown` 只管「在你机器上、一个实验一份」的服务。要在跑 agent 前按实验在**Sandbox 里**准备环境(装二进制、预热、跨 attempt 载入和回存状态),挂在 `sandbox` 字段的 spec 上:
|
|
214
|
-
|
|
215
|
-
```ts
|
|
216
|
-
export default defineExperiment({
|
|
217
|
-
agent: codexAgent({ mcpServers: [mempalMcp] }),
|
|
218
|
-
sandbox: e2bSandbox({ template: "fasteval-agents" })
|
|
219
|
-
.before(async (sandbox, context) => {
|
|
220
|
-
await mempalLoad(sandbox, "codex");
|
|
221
|
-
context.onCleanup(async (sandbox) => {
|
|
222
|
-
await mempalSave(sandbox, "codex");
|
|
223
|
-
});
|
|
224
|
-
}),
|
|
225
|
-
sandboxReuse: true,
|
|
226
|
-
maxConcurrency: 1, // 本 Invocation 内串行
|
|
227
|
-
sharedState: { key: "mempal/codex/cohort-a" },
|
|
228
|
-
});
|
|
119
|
+
```bash
|
|
120
|
+
pnpm exec niceeval show --experiment prompts/v1 --experiment prompts/v2
|
|
229
121
|
```
|
|
230
122
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
固定的 Agent CLI、系统包和大模型缓存应先做进 image/template/snapshot,也可以声明为低频 `.before()` action。NiceEval 会复用未变化的 Docker 准备前缀,不必因为评估代码或最后一层 `.env` 改变而重跑固定安装。从官方 Docker 镜像、E2B template 或 Vercel runtime 派生预制环境的步骤见 [Sandbox · 从官方基线继续构建以提速](/zh/tutorials/sandbox-providers#从官方基线继续构建以提速)。
|
|
123
|
+
每个 Experiment 的 `Summary` 里会列出这几项:
|
|
234
124
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
实验级 Hook 起宿主机侧服务,Sandbox callback 在 Attempt 前把坐标写进去,并立即登记回存收尾。两层在同一个文件里靠模块变量衔接,时序由 runner 保证:实验级 `setup` 早于本实验任何 Sandbox callback,callback 读到的变量一定已经赋好值:
|
|
240
|
-
|
|
241
|
-
```ts
|
|
242
|
-
// experiments/compare/claude--nowledge.ts
|
|
243
|
-
import { defineExperiment } from "niceeval";
|
|
244
|
-
import { e2bSandbox } from "niceeval/sandbox";
|
|
245
|
-
import { nowledgeAgent, nowledgeTunnel } from "../../agents/nowledge.ts";
|
|
246
|
-
import { loadMemoryState, saveMemoryState } from "../shared/memory-state.ts";
|
|
247
|
-
|
|
248
|
-
let tunnel: { url: string; apiKey: string; stop(): Promise<void> };
|
|
249
|
-
|
|
250
|
-
export default defineExperiment({
|
|
251
|
-
agent: nowledgeAgent(() => ({ url: tunnel.url, apiKey: tunnel.apiKey })),
|
|
252
|
-
evals: ["memory/"],
|
|
253
|
-
maxConcurrency: 1,
|
|
254
|
-
sharedState: { key: "nowledge/claude/cohort-a" },
|
|
255
|
-
sandbox: e2bSandbox({ template: "niceeval-agents" })
|
|
256
|
-
.before(async (sandbox, ctx) => {
|
|
257
|
-
// 每条真实 Attempt 一次,晚于实验级 setup:把宿主机侧坐标写进 Sandbox
|
|
258
|
-
await sandbox.writeText(
|
|
259
|
-
".nowledge/config.json",
|
|
260
|
-
JSON.stringify({ url: tunnel.url, apiKey: tunnel.apiKey }),
|
|
261
|
-
);
|
|
262
|
-
await loadMemoryState(sandbox, ctx.experimentId);
|
|
263
|
-
ctx.onCleanup(async (sandbox) => {
|
|
264
|
-
await saveMemoryState(sandbox, ctx.experimentId);
|
|
265
|
-
});
|
|
266
|
-
}),
|
|
267
|
-
async setup(ctx) {
|
|
268
|
-
tunnel = await nowledgeTunnel({ signal: ctx.signal }); // 整场一次,宿主机侧
|
|
269
|
-
},
|
|
270
|
-
async teardown() {
|
|
271
|
-
await tunnel?.stop(); // 全部 Attempt 收尾后拆
|
|
272
|
-
},
|
|
273
|
-
});
|
|
125
|
+
```text
|
|
126
|
+
Observed 12/12
|
|
127
|
+
Verdicts 8 passed; 4 failed; 0 errored; 0 skipped
|
|
128
|
+
Pass rate 66.67%
|
|
274
129
|
```
|
|
275
130
|
|
|
276
|
-
|
|
131
|
+
`Observed` 是有结果的 Attempt 数和计划数。两个数不相等时,说明有些 Attempt 还没有结果,这时的通过率不能直接和另一边比较。
|
|
277
132
|
|
|
278
|
-
|
|
133
|
+
除了通过率,还要看耗时、token、成本和失败的类型。一个配置通过率高一点,成本却翻了一倍,不一定值得换。把两次 Run 并排比较,见[比较多个固定 Run](/zh/tutorials/compare-runs);在浏览器里看,用 `niceeval view`。
|
|
279
134
|
|
|
280
|
-
|
|
135
|
+
## 让比较有意义
|
|
281
136
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
export function nowledgeLifecycle() {
|
|
288
|
-
let instance: string | undefined;
|
|
289
|
-
let env: { url: string; apiKey: string } | undefined;
|
|
290
|
-
|
|
291
|
-
return {
|
|
292
|
-
/** agent / MCP 工厂经它读连接信息:闭包值,setup 之后才存在 */
|
|
293
|
-
endpoint: () => env!,
|
|
294
|
-
|
|
295
|
-
async setup(ctx: ExperimentHookContext) {
|
|
296
|
-
instance = `exp-${ctx.experimentId.replace(/[^A-Za-z0-9]+/g, "-")}`;
|
|
297
|
-
ctx.progress({ message: `[nowledge] activating ${instance}` });
|
|
298
|
-
await memctl("up", instance); // 容器 + 隧道,全新记忆库
|
|
299
|
-
env = await readInstanceEnv(instance);
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
async teardown(ctx: ExperimentHookContext) {
|
|
303
|
-
if (!instance) return; // setup 没走到起实例就抛了:无事可扫
|
|
304
|
-
await memctl("down", instance); // 释放是必达底线
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
/** 每条真实 Attempt 一次:把闭包坐标写进 Sandbox */
|
|
308
|
-
sandboxBefore(): SandboxCommand {
|
|
309
|
-
return async (sandbox) => {
|
|
310
|
-
await sandbox.writeText(
|
|
311
|
-
".nowledge/env",
|
|
312
|
-
`NMEM_URL=${env!.url}\nNMEM_API_KEY=${env!.apiKey}\n`,
|
|
313
|
-
);
|
|
314
|
-
};
|
|
315
|
-
},
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
```
|
|
137
|
+
- 比较期间保持评估用例集合不变,否则两边比的不是同一批题。
|
|
138
|
+
- 非确定性强的 Agent,尤其是 Coding Agent,每个配置至少跑 3 次。
|
|
139
|
+
- 每次只改一个变量。同时换模型又换 prompt,就分不清是谁的功劳。
|
|
140
|
+
- 失败要按原因归类看,不只看总分。
|
|
319
141
|
|
|
320
|
-
|
|
142
|
+
## 只跑部分评估用例
|
|
321
143
|
|
|
322
|
-
|
|
323
|
-
// experiments/compare/codex-gpt-5.4--nowledge.ts
|
|
324
|
-
const nowledge = nowledgeLifecycle();
|
|
325
|
-
export default defineExperiment({
|
|
326
|
-
agent: codexAgent(nowledgeCodexConfig(nowledge.endpoint)),
|
|
327
|
-
sandbox: e2bSandbox({ template: CODEX_TEMPLATE }).before(nowledge.sandboxBefore()),
|
|
328
|
-
setup: nowledge.setup,
|
|
329
|
-
teardown: nowledge.teardown,
|
|
330
|
-
maxConcurrency: 1, // 中心化记忆库,attempt 串行累积
|
|
331
|
-
});
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
两条纪律保证多个实验并发跑同一套代码不互相踩踏:
|
|
335
|
-
|
|
336
|
-
- **工厂在 import 期只创建闭包,不做 I/O、不读配置**——实验文件在 `niceeval exp` 的发现阶段就会被 import,import 抛错会连累同批无关实验。所有硬失败留给 `setup`。
|
|
337
|
-
- **运行时坐标活在工厂闭包里,不放模块级单例**——同批并行的两个实验各持一份,互不覆写。坐标在 `setup` 之后才存在。
|
|
338
|
-
|
|
339
|
-
服务起多份太贵、必须让同批实验共享一份实例时,用「首进启动、末出关停」的引用计数代替按实验各建一份:
|
|
144
|
+
每个 Experiment 用 `evals` 选择要跑哪些评估用例,默认是全部。可以写 ID 前缀数组,也可以写一个函数:
|
|
340
145
|
|
|
341
146
|
```ts
|
|
342
|
-
|
|
343
|
-
let refs = 0;
|
|
344
|
-
let starting: Promise<void> | undefined;
|
|
345
|
-
let service: { url: string; stop(): Promise<void> } | undefined;
|
|
346
|
-
|
|
347
|
-
export const sharedNowledge = {
|
|
348
|
-
async setup() {
|
|
349
|
-
refs += 1;
|
|
350
|
-
starting ??= startNowledge().then((s) => { service = s; });
|
|
351
|
-
await starting; // 并发实验等同一个启动。启动失败各自抛错
|
|
352
|
-
},
|
|
353
|
-
async teardown() {
|
|
354
|
-
refs -= 1;
|
|
355
|
-
if (refs === 0) {
|
|
356
|
-
await service?.stop(); // 启动失败时 service 未赋值,防御式跳过
|
|
357
|
-
service = undefined;
|
|
358
|
-
starting = undefined;
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
|
-
};
|
|
147
|
+
evals: (eval) => eval.id.startsWith("coding/") && eval.tags.includes("coding"),
|
|
362
148
|
```
|
|
363
149
|
|
|
364
|
-
|
|
150
|
+
`eval.id` 是从文件路径推导出的项目内 ID,不是绝对路径,可以直接用 `startsWith` 判断。
|
|
365
151
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
## 让不同评估用例使用不同预制环境
|
|
152
|
+
## 常用字段
|
|
369
153
|
|
|
370
|
-
|
|
154
|
+
| 字段 | 用途 |
|
|
155
|
+
|---|---|
|
|
156
|
+
| `agent` | 选择并配置 Adapter。必填 |
|
|
157
|
+
| `model` | 单个模型名,经 `ctx.model` 传给 Adapter |
|
|
158
|
+
| `reasoningEffort` | 推理努力程度,例如 `"high"`,经 `ctx.reasoningEffort` / `t.reasoningEffort` 传递 |
|
|
159
|
+
| `flags` | 实验条件,经 `ctx.flags` / `t.flags` 传递 |
|
|
160
|
+
| `attempts` | 每条评估用例最多跑几次 |
|
|
161
|
+
| `earlyExit` | 通过一次就停止剩下的 Attempt。默认关闭,跑满才能算出完整通过率 |
|
|
162
|
+
| `evals` | `"*"`、ID 前缀数组,或返回 Boolean 的函数 |
|
|
163
|
+
| `timeoutMs` | 单个 Attempt 的超时 |
|
|
164
|
+
| `budget` | 这个配置的花费上限,单位美元 |
|
|
165
|
+
| `maxConcurrency` | 这个配置同时跑几个 Attempt |
|
|
166
|
+
| `labels` | 只用于报告分组的标注,Adapter 和评估用例都读不到 |
|
|
167
|
+
| `sandbox` | Coding Agent 使用的 Sandbox,见 [Sandbox](/zh/tutorials/sandbox-providers) |
|
|
168
|
+
| `plugins` | 复用一整套运行条件,见 [Plugin](/zh/tutorials/plugins) |
|
|
169
|
+
| `setup` / `teardown` | 启动和关闭整个实验共用的服务,见[启动实验共享服务](/zh/tutorials/experiment-services) |
|
|
170
|
+
| `sharedState` | 跨多次运行共享状态时的独占 key,见[启动实验共享服务](/zh/tutorials/experiment-services#跨-attempt-保存状态) |
|
|
171
|
+
|
|
172
|
+
字段全集见 [defineExperiment 参考](/zh/reference/define-experiment)。
|
|
173
|
+
|
|
174
|
+
## 不同评估用例需要不同环境
|
|
175
|
+
|
|
176
|
+
一批真实任务可能需要不同版本的运行时,例如有的题要 Python 3.9。这时把 Sandbox 直接写在评估用例上,让任务和它需要的环境放在一起:
|
|
371
177
|
|
|
372
178
|
```ts
|
|
373
179
|
// evals/astropy-2021.eval.ts
|
|
374
180
|
export default defineEval({
|
|
375
181
|
sandbox: e2bSandbox({ template: "codex-python39" }),
|
|
376
182
|
async test(t) {
|
|
377
|
-
//
|
|
183
|
+
// 发送任务并验证结果
|
|
378
184
|
},
|
|
379
185
|
});
|
|
380
186
|
```
|
|
381
187
|
|
|
188
|
+
多条评估用例共用同一个环境时,用普通函数复用:
|
|
189
|
+
|
|
382
190
|
```ts
|
|
383
|
-
// evals/shared/python39.ts
|
|
191
|
+
// evals/shared/python39.ts
|
|
384
192
|
import { e2bSandbox } from "niceeval/sandbox";
|
|
385
193
|
|
|
386
194
|
export const python39 = () => e2bSandbox({ template: "codex-python39" });
|
|
387
195
|
```
|
|
388
196
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
197
|
+
Experiment 这时只需要写 Agent,同一个 Experiment 仍然能覆盖所有评估用例。NiceEval 在创建任何 Sandbox 之前,会先检查每条评估用例的环境是否和 Experiment 的配置兼容。
|
|
198
|
+
|
|
199
|
+
## 一个应用用多个模型
|
|
200
|
+
|
|
201
|
+
应用内部有规划、回复、审查等不同角色,各用一个模型时,用 `models` 按用途分别指定:
|
|
392
202
|
|
|
203
|
+
```ts
|
|
393
204
|
export default defineExperiment({
|
|
394
|
-
|
|
205
|
+
adapter: workflowAdapter,
|
|
206
|
+
models: {
|
|
207
|
+
planner: { model: "provider/model-a" },
|
|
208
|
+
responder: { model: "provider/model-b" },
|
|
209
|
+
reviewer: { model: "provider/model-a" },
|
|
210
|
+
},
|
|
395
211
|
});
|
|
396
212
|
```
|
|
397
213
|
|
|
398
|
-
|
|
214
|
+
Adapter 从 `ctx.models` 读取这份配置交给应用,每次请求模型时在 `ctx.recordUsage` 里写上对应的 `modelSlot`。这样用量和费用能按用途分开统计;没被调用的角色不会产生费用。
|
|
215
|
+
|
|
216
|
+
`models` 不能和 `model`、`reasoningEffort` 同时写。Agent 类的 Adapter 只用单个 `model`。
|
|
399
217
|
|
|
400
|
-
|
|
218
|
+
运行后用 `niceeval show @<locator> --usage` 查看一次运行里各个模型的用量和费用。Judge 的用量没有上报时会显示为不可用,总费用只给出已知部分。
|