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,105 +1,136 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
sidebarTitle: "
|
|
4
|
-
description: "用 defineEval
|
|
2
|
+
title: "编写评估用例:单轮、多轮和测试集"
|
|
3
|
+
sidebarTitle: "编写评估用例"
|
|
4
|
+
description: "用 defineEval 写评估用例:发送消息、检查回复和工具调用、多轮对话、用一份测试集生成多条用例,以及给 Coding Agent 准备工作区和收尾外部资源。"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
import { Lifecycle } from '/snippets/widgets.jsx';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
快速开始里那条评估用例只检查了回复里有没有“30 天”。真实的 Agent 要做的事更多:调用对的工具、在多轮对话里记住上下文、改对代码。这一页从一条最简单的用例出发,逐步加上这些检查。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
import { defineEval, type JsonValue } from "niceeval";
|
|
13
|
-
import type { SandboxLayer } from "niceeval/sandbox";
|
|
14
|
-
import type { JudgeSelection } from "niceeval/judge";
|
|
15
|
-
|
|
16
|
-
export default defineEval({
|
|
17
|
-
description?: string;
|
|
18
|
-
tags?: string[];
|
|
19
|
-
judge?: JudgeSelection;
|
|
20
|
-
reporters?: Reporter[];
|
|
21
|
-
timeoutMs?: number;
|
|
22
|
-
sandbox?: SandboxLayer;
|
|
23
|
-
metadata?: Record<string, JsonValue>;
|
|
24
|
-
async setup(sandbox, ctx) { /* task fixture + progress/diagnostic */ },
|
|
25
|
-
async test(t) { /* interactions + assertions */ },
|
|
26
|
-
});
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
`judge` 为这道题指定模型字符串或完整 Provider。例如 `judge: "judge-model"` 只替换已选 Provider 的模型;Experiment 的 `judgeRuntime` 还能进一步替换。它不声明允许使用哪些 Match。
|
|
11
|
+
## 一条评估用例的结构
|
|
30
12
|
|
|
31
|
-
|
|
13
|
+
评估用例写在 `evals/` 下,文件名以 `.eval.ts` 结尾,默认导出 `defineEval(...)`:
|
|
32
14
|
|
|
33
15
|
```ts
|
|
16
|
+
// evals/billing/refund.eval.ts → ID 是 billing/refund
|
|
34
17
|
import { defineEval } from "niceeval";
|
|
35
|
-
import { dockerSandbox } from "niceeval/sandbox";
|
|
36
18
|
|
|
37
|
-
// evals/coding/fix-button.eval.ts → id: coding/fix-button
|
|
38
19
|
export default defineEval({
|
|
39
|
-
description: "
|
|
40
|
-
tags: ["
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
description: "能正确回答退款政策",
|
|
21
|
+
tags: ["billing"],
|
|
22
|
+
async test(t) {
|
|
23
|
+
// 发消息,再检查结果
|
|
24
|
+
},
|
|
43
25
|
});
|
|
44
26
|
```
|
|
45
27
|
|
|
46
|
-
|
|
28
|
+
- 文件路径决定 ID:`evals/billing/refund.eval.ts` 的 ID 是 `billing/refund`。只有 `.eval.ts` 和 `.eval.tsx` 文件会被发现。
|
|
29
|
+
- `description` 会显示在结果里,写成一句“这条用例验证什么”。
|
|
30
|
+
- `tags` 用于按标签选择,例如 `niceeval exp local --tag billing`,Experiment 的 `evals` 函数也能读到它。
|
|
31
|
+
- `test(t)` 是用例主体。`t` 上有发送消息、断言和操作 Sandbox 的全部方法。
|
|
47
32
|
|
|
48
|
-
|
|
33
|
+
其它字段,例如 `judge`、`timeoutMs`、`sandbox`、`metadata`,见 [defineEval 参考](/zh/reference/define-eval)。
|
|
34
|
+
|
|
35
|
+
## 单轮:发一条消息,检查结果
|
|
49
36
|
|
|
50
37
|
```ts
|
|
51
38
|
import { defineEval } from "niceeval";
|
|
52
39
|
import { includes, jsonMatch, toolMatch } from "niceeval/expect";
|
|
53
40
|
|
|
54
41
|
export default defineEval({
|
|
55
|
-
description: "
|
|
42
|
+
description: "问天气时调用工具",
|
|
56
43
|
async test(t) {
|
|
57
|
-
await t.send("
|
|
44
|
+
await t.send("布鲁克林今天天气怎么样?");
|
|
45
|
+
|
|
58
46
|
t.succeeded();
|
|
59
|
-
t.calledTool(
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
t.check(t.reply, includes("sunny"));
|
|
47
|
+
t.calledTool(toolMatch("get_weather", { input: jsonMatch({ city: "Brooklyn" }) }).exactly(1));
|
|
48
|
+
t.check(t.reply, includes("晴"));
|
|
63
49
|
},
|
|
64
50
|
});
|
|
65
51
|
```
|
|
66
52
|
|
|
67
|
-
|
|
53
|
+
这里用到三种检查:
|
|
54
|
+
|
|
55
|
+
- `t.succeeded()`:这一轮正常完成,没有失败或停在等待状态。
|
|
56
|
+
- `t.calledTool(...)`:调用了 `get_weather`,参数里的城市是 Brooklyn,而且只调用了一次。工具调用要 Adapter 上报对应事件才看得到,见[编写 Send](/zh/tutorials/write-send#第四步:把工具解析成事件)。
|
|
57
|
+
- `t.check(value, match)`:对一个具体的值做检查,这里是回复文本。
|
|
58
|
+
|
|
59
|
+
一条检查没通过,不会中断后面的检查。一次运行结束后,你能一次看到所有没满足的条件,不用改一处、跑一次。后面的代码确实依赖某条结果时,用 `await t.check(...).orStop()` 在失败时停下。
|
|
68
60
|
|
|
69
|
-
|
|
61
|
+
给检查加上 `.label("...")`,结果里显示的就是你写的说明,比显示一段代码好读:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
t.calledTool("get_weather").label("调用了天气工具");
|
|
65
|
+
```
|
|
70
66
|
|
|
71
|
-
|
|
67
|
+
`t.send()` 返回这一轮的 `Turn`。需要分别检查某一轮时,保存它:
|
|
68
|
+
|
|
69
|
+
| 属性 | 内容 |
|
|
72
70
|
|---|---|
|
|
73
|
-
| `turn.
|
|
71
|
+
| `turn.message` | 助手的文本回复 |
|
|
72
|
+
| `turn.toolCalls` | 这一轮的工具调用 |
|
|
74
73
|
| `turn.data` | 结构化输出 |
|
|
75
74
|
| `turn.status` | `"completed"`、`"failed"` 或 `"waiting"` |
|
|
76
|
-
| `turn.usage` | token
|
|
77
|
-
| `turn.
|
|
78
|
-
| `turn.toolCalls` | 本轮工具调用 |
|
|
75
|
+
| `turn.usage` | token 和费用 |
|
|
76
|
+
| `turn.events` | 完整的标准事件流,其它属性都从这里来 |
|
|
79
77
|
|
|
80
|
-
##
|
|
78
|
+
## 多轮:检查上下文接不接得上
|
|
81
79
|
|
|
82
80
|
```ts
|
|
83
81
|
export default defineEval({
|
|
84
|
-
description: "
|
|
82
|
+
description: "先起草邮件,确认后再发送",
|
|
85
83
|
async test(t) {
|
|
86
|
-
const draft = await t.send("
|
|
84
|
+
const draft = await t.send("帮我起草一封跟进邮件。");
|
|
87
85
|
draft.succeeded();
|
|
88
|
-
t.check(draft.message, includes("
|
|
86
|
+
t.check(draft.message, includes("此致"));
|
|
89
87
|
|
|
90
|
-
await t.send("
|
|
88
|
+
await t.send("可以,发出去吧。");
|
|
91
89
|
t.calledTool("send_email");
|
|
92
90
|
},
|
|
93
91
|
});
|
|
94
92
|
```
|
|
95
93
|
|
|
96
|
-
|
|
94
|
+
同一个 `t` 上连续 `send`,就是同一段对话。`draft.succeeded()` 只检查第一轮;`t.calledTool` 检查整个用例里有没有调用过。需要两段互不相干的对话,例如模拟两个用户,用 `t.newSession()` 开一个新会话。
|
|
95
|
+
|
|
96
|
+
多轮对话要 Adapter 把上一轮的上下文带给应用,见[编写 Send](/zh/tutorials/write-send#第二步:接上之前的消息)。
|
|
97
|
+
|
|
98
|
+
## 开放式的回答交给 Judge
|
|
99
|
+
|
|
100
|
+
“回答是否有依据”“语气是否适合小学生”这类问题,正则写不出来。把它交给裁判模型 Judge 打分:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { defineEval, defineJudge } from "niceeval";
|
|
104
|
+
|
|
105
|
+
const grounded = defineJudge({
|
|
106
|
+
name: "grounded-answer",
|
|
107
|
+
rubric: "根据 question 评价 answer 是否基于事实作答,而不是编造或含糊其辞。",
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export default defineEval({
|
|
111
|
+
async test(t) {
|
|
112
|
+
const turn = await t.send("北京今天天气怎么样?");
|
|
113
|
+
t.judge({ question: turn.input, answer: turn.message }, grounded).gate(0.7).label("回答有依据");
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Judge 给出 0 到 1 的分数,`.gate(0.7)` 表示低于 0.7 就不通过。能用确定规则检查的,例如调用了哪个工具、文件有没有改,优先用确定规则;Judge 留给真正开放的质量。配置 Judge 用哪个模型,见[配置并验证 Judge](/zh/tutorials/verify-judge)。
|
|
97
119
|
|
|
98
|
-
##
|
|
120
|
+
## 一份测试集生成多条用例
|
|
99
121
|
|
|
100
|
-
|
|
122
|
+
几十条用例逻辑相同、只有输入不同时,不用写几十个文件。从一个文件导出数组:
|
|
101
123
|
|
|
102
124
|
```ts
|
|
125
|
+
// evals/sql.eval.ts
|
|
126
|
+
import { defineEval } from "niceeval";
|
|
127
|
+
import { equals } from "niceeval/expect";
|
|
128
|
+
|
|
129
|
+
const rows = [
|
|
130
|
+
{ task: "统计订单数", prompt: "一共有多少订单?", expected: "42" },
|
|
131
|
+
{ task: "最贵商品", prompt: "最贵的商品是什么?", expected: "MacBook Pro" },
|
|
132
|
+
];
|
|
133
|
+
|
|
103
134
|
export default rows.map((row) =>
|
|
104
135
|
defineEval({
|
|
105
136
|
description: row.task,
|
|
@@ -111,40 +142,34 @@ export default rows.map((row) =>
|
|
|
111
142
|
);
|
|
112
143
|
```
|
|
113
144
|
|
|
114
|
-
|
|
145
|
+
生成的 ID 是 `sql/0000`、`sql/0001`。从 YAML 或 JSON 读测试集、给每条起稳定的 ID,见[数据驱动测试](/zh/tutorials/dataset-fanout)。
|
|
115
146
|
|
|
116
|
-
##
|
|
147
|
+
## 给 Coding Agent 准备工作区
|
|
117
148
|
|
|
118
|
-
Coding Agent
|
|
149
|
+
评估 Coding Agent 时,用例照样是普通的 `.eval.ts`,只是要先把一个项目放进 Sandbox,再让 Agent 去改:
|
|
119
150
|
|
|
120
151
|
```ts
|
|
121
|
-
import { defineEval } from "niceeval";
|
|
122
|
-
|
|
123
152
|
export default defineEval({
|
|
124
|
-
description: "
|
|
153
|
+
description: "创建 Button 组件",
|
|
125
154
|
async test(t) {
|
|
126
155
|
await t.sandbox.uploadDirectory("../workspaces/ts-starter");
|
|
127
|
-
await t.send("
|
|
156
|
+
const turn = await t.send("创建 src/components/Button.tsx,接受 label 和 onClick 两个 props。");
|
|
157
|
+
turn.succeeded();
|
|
128
158
|
t.sandbox.fileChanged("src/components/Button.tsx");
|
|
129
159
|
},
|
|
130
160
|
});
|
|
131
161
|
```
|
|
132
162
|
|
|
133
|
-
|
|
163
|
+
Sandbox 从哪来、怎样用项目自己的测试判分,见 [Fixture](/zh/tutorials/fixtures) 和 [Sandbox Agent](/zh/tutorials/sandbox-agent)。
|
|
134
164
|
|
|
135
|
-
##
|
|
165
|
+
## 运行中提示进度和问题
|
|
136
166
|
|
|
137
|
-
`
|
|
167
|
+
准备步骤比较慢时,用 `t.progress` 在终端显示当前在做什么;遇到值得记下、但不影响结论的情况,用 `t.diagnostic` 记一条诊断:
|
|
138
168
|
|
|
139
169
|
```ts
|
|
140
170
|
export default defineEval({
|
|
141
|
-
async setup(sandbox, ctx) {
|
|
142
|
-
ctx.progress({ message: "安装 fixture 依赖" });
|
|
143
|
-
await sandbox.runCommand("npm", ["install"]);
|
|
144
|
-
},
|
|
145
|
-
|
|
146
171
|
async test(t) {
|
|
147
|
-
t.progress({ message: "
|
|
172
|
+
t.progress({ message: "上传项目", current: 1, total: 2 });
|
|
148
173
|
await t.sandbox.uploadDirectory("../fixtures/project");
|
|
149
174
|
|
|
150
175
|
const preflight = await inspectFixture();
|
|
@@ -162,75 +187,67 @@ export default defineEval({
|
|
|
162
187
|
});
|
|
163
188
|
```
|
|
164
189
|
|
|
165
|
-
`progress`
|
|
166
|
-
|
|
167
|
-
## 评估的生命周期
|
|
190
|
+
`progress` 只在运行时显示,不会保存。`diagnostic` 会随这次 Attempt 保存,事后能在结果里看到,但它不会改变通过与否。业务结论写成断言;准备工作失败、没法继续时,直接抛出异常,这次运行会记为 `errored`。
|
|
168
191
|
|
|
169
|
-
|
|
192
|
+
## 准备和收尾外部资源
|
|
170
193
|
|
|
171
|
-
|
|
172
|
-
title="一条 Attempt 从排队到收尾"
|
|
173
|
-
hint="悬停暂停"
|
|
174
|
-
note={<>收尾段不计入这条 Attempt 的耗时口径。用 <code>niceeval show @<attempt-locator></code> 审阅运行信息,或用固定 query operation 读取机器结果。</>}
|
|
175
|
-
phases={[
|
|
176
|
-
{ name: "experiment.setup", what: "起隧道、起共享服务", times: "整场一次" },
|
|
177
|
-
{ name: "sandbox.queue", what: "等一个并发位", times: "每 Attempt" },
|
|
178
|
-
{ name: "sandbox.create", what: "Provider 起 Sandbox", times: "每个 Sandbox 一次" },
|
|
179
|
-
{ name: "sandbox.prepare", what: "恢复缓存前缀、执行有序 before action", times: "按 occurrence" },
|
|
180
|
-
{ name: "workspace.baseline", what: "记下改动基线", times: "每 Attempt" },
|
|
181
|
-
{ name: "eval.setup", what: "这条评估用例的 Fixture", times: "每 Attempt" },
|
|
182
|
-
{ name: "agent.setup", what: "装 Agent CLI、写主配置", times: "每 Attempt" },
|
|
183
|
-
{ name: "eval.run", what: "整段 test(t),含所有 send 与手工命令", times: "每 Attempt" },
|
|
184
|
-
{ name: "workspace.diff", what: "折出 Agent 造成的文件改动", times: "每 Attempt" },
|
|
185
|
-
{ name: "assertions.evaluate", what: "断言收口与判定,含 Judge 调用", times: "每 Attempt" },
|
|
186
|
-
{ name: "eval.teardown", what: "收尾链第一段,Sandbox 还活着", times: "每 Attempt" },
|
|
187
|
-
{ name: "sandbox.teardown", what: "反向执行 cleanup / after,最后销毁 Sandbox", times: "按 occurrence" },
|
|
188
|
-
]}
|
|
189
|
-
/>
|
|
190
|
-
|
|
191
|
-
右列是「谁的一次」:四层 Hook 共用同一副成对形态,但触发频次不同。不声明 `sandboxReuse` 时每条 Attempt 独占一个 Sandbox,所以「每个 Sandbox 一次」和「每 Attempt」重合。声明复用之后两者分开,见[复用 Sandbox](/zh/tutorials/sandbox-reuse)。
|
|
192
|
-
|
|
193
|
-
大多数 Fixture 不需要 `teardown`——写进 Sandbox 的起始文件、装的依赖随 Sandbox 销毁自动没了。需要 `teardown` 的是**Sandbox 外**的 Fixture:在共享外部服务里为这个 Attempt 建的临时资源(临时 repo、bucket、队列 topic),不收就泄漏。
|
|
194
|
-
|
|
195
|
-
同一条评估用例的多个 Attempt(`attempts` 大于 1、或同批多个实验跑同一条评估用例)并发执行且共享同一个模块,`setup` 的句柄不能放进普通模块变量——会被后一个并发 Attempt 覆写。以 `sandbox` 实例作键存取(`WeakMap`):sandbox 与 Attempt 一一对应,天然是 per-attempt 键:
|
|
194
|
+
有的用例要在 Sandbox 之外建临时资源,例如在共享的 Git 服务上建一个临时仓库。这时用 `setup` 准备、`teardown` 收尾,每个 Attempt 各执行一次:
|
|
196
195
|
|
|
197
196
|
```ts
|
|
198
197
|
// evals/pr-review/close-outdated.eval.ts
|
|
199
198
|
import { defineEval } from "niceeval";
|
|
200
199
|
import type { Sandbox } from "niceeval/sandbox";
|
|
201
200
|
|
|
202
|
-
//
|
|
201
|
+
// 同一条用例的多个 Attempt 会并发执行、共享这个模块,所以按 sandbox 存取,不用普通模块变量
|
|
203
202
|
const fixtures = new WeakMap<Sandbox, { repoUrl: string; destroy(): Promise<void> }>();
|
|
204
203
|
|
|
205
204
|
export default defineEval({
|
|
206
205
|
async setup(sandbox, ctx) {
|
|
207
|
-
ctx.progress({ message: "
|
|
208
|
-
const fixture = await createFixtureRepo("pr-review/close-outdated");
|
|
206
|
+
ctx.progress({ message: "创建临时仓库" });
|
|
207
|
+
const fixture = await createFixtureRepo("pr-review/close-outdated");
|
|
209
208
|
fixtures.set(sandbox, fixture);
|
|
210
209
|
await sandbox.runCommand("git", ["clone", fixture.repoUrl, "workspace"]);
|
|
211
210
|
},
|
|
212
211
|
async teardown(sandbox) {
|
|
213
|
-
await fixtures.get(sandbox)?.destroy(); // setup
|
|
212
|
+
await fixtures.get(sandbox)?.destroy(); // setup 中途失败时可能没建成
|
|
214
213
|
},
|
|
215
|
-
async test(t) { /*
|
|
214
|
+
async test(t) { /* 让 Agent 清理过期 PR,再断言 */ },
|
|
216
215
|
});
|
|
217
216
|
```
|
|
218
217
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
218
|
+
几条要点:
|
|
219
|
+
|
|
220
|
+
- 大多数用例不需要 `teardown`。写进 Sandbox 的文件、装的依赖,会随 Sandbox 销毁一起消失。只有 Sandbox 之外的资源才需要手动清理。
|
|
221
|
+
- `setup` 开始过,`teardown` 就一定会执行,`setup` 抛错也一样,所以要防御资源没建成的情况。
|
|
222
|
+
- `teardown` 抛错或超过 30 秒只记一条 `teardown-failed` 诊断,不会改变这次 Attempt 已经得出的结论。想让某个检查影响结论,放进 `setup` 或 `test`。
|
|
223
|
+
- `attempts` 大于 1 时,同一条用例的多个 Attempt 并发执行。把句柄存进以 `sandbox` 为键的 `WeakMap`,每个 Attempt 一份,互不覆盖。
|
|
224
|
+
|
|
225
|
+
这些步骤在一次 Attempt 里的完整顺序:
|
|
226
|
+
|
|
227
|
+
<Lifecycle
|
|
228
|
+
title="一次 Attempt 从排队到收尾"
|
|
229
|
+
hint="悬停暂停"
|
|
230
|
+
note={<>收尾阶段不计入这次 Attempt 的耗时。用 <code>niceeval show @<attempt-locator> --timing</code> 查看每一步实际花了多久。</>}
|
|
231
|
+
phases={[
|
|
232
|
+
{ name: "experiment.setup", what: "启动实验共享服务", times: "整个实验一次" },
|
|
233
|
+
{ name: "sandbox.queue", what: "等一个并发名额", times: "每次 Attempt" },
|
|
234
|
+
{ name: "sandbox.create", what: "Provider 创建 Sandbox", times: "每个 Sandbox 一次" },
|
|
235
|
+
{ name: "sandbox.prepare", what: "恢复缓存、执行准备步骤", times: "每个 Sandbox 一次" },
|
|
236
|
+
{ name: "workspace.baseline", what: "记下文件基线", times: "每次 Attempt" },
|
|
237
|
+
{ name: "eval.setup", what: "这条用例的准备", times: "每次 Attempt" },
|
|
238
|
+
{ name: "agent.setup", what: "安装 Agent CLI、写配置", times: "每次 Attempt" },
|
|
239
|
+
{ name: "eval.run", what: "整段 test(t)", times: "每次 Attempt" },
|
|
240
|
+
{ name: "workspace.diff", what: "算出 Agent 改了哪些文件", times: "每次 Attempt" },
|
|
241
|
+
{ name: "assertions.evaluate", what: "计算断言和判定,包括 Judge", times: "每次 Attempt" },
|
|
242
|
+
{ name: "eval.teardown", what: "这条用例的收尾", times: "每次 Attempt" },
|
|
243
|
+
{ name: "sandbox.teardown", what: "执行收尾步骤,销毁 Sandbox", times: "每个 Sandbox 一次" },
|
|
244
|
+
]}
|
|
245
|
+
/>
|
|
246
|
+
|
|
247
|
+
默认每次 Attempt 独占一个 Sandbox,“每个 Sandbox 一次”和“每次 Attempt”是同一回事。开启复用后两者才会分开,见[复用 Sandbox](/zh/tutorials/sandbox-reuse)。
|
|
248
|
+
|
|
249
|
+
## 接下来
|
|
250
|
+
|
|
251
|
+
- 任务有部分完成度,想按完成了几步给分:读[通过制与计分制](/zh/tutorials/evaluation-kinds)。
|
|
252
|
+
- 想把判据写得清楚、不误判:读 [NiceEval Taste](/zh/tutorials/niceeval-taste)。
|
|
253
|
+
- 全部匹配器:查 [expect 参考](/zh/reference/expect)。
|
|
@@ -1,39 +1,56 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "在 CI
|
|
2
|
+
title: "在 CI 里自动跑评估,挡住回归"
|
|
3
3
|
sidebarTitle: "CI 集成"
|
|
4
|
-
description: "
|
|
4
|
+
description: "在每个 PR 上运行同一条 niceeval exp,评估不通过就让 CI 变红。保留这次运行的 Run ID 供后续步骤读取,并把 JUnit 文件交给 CI 平台展示。"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
有人改了 prompt,本地试了两次觉得没问题就合并了,第二天才发现另一类问题全答错了。把评估放进 CI,每个 PR 都自动跑一遍,回归在合并前就能被发现。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
CI 里跑的就是你本地用的那条 `niceeval exp`,不需要额外配置:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- 评估不通过、运行出错或被中断时,进程以非零状态退出,CI 自然变红。
|
|
12
|
+
- 加 `--json` 时,最后一行是这次运行的 receipt,里面有新建的 Run ID,后续步骤可以用它读取结果。
|
|
13
|
+
- 加 `--junit <path>` 时,会写出 JUnit 文件,让 CI 平台按测试用例展示结果。
|
|
14
|
+
|
|
15
|
+
## 决定什么情况让 CI 变红
|
|
16
|
+
|
|
17
|
+
CI 是否变红只看进程的退出状态。下面任一情况都会以非零状态退出:
|
|
18
|
+
|
|
19
|
+
- 通过制评估有未通过的 Attempt。
|
|
20
|
+
- 计分制评估有显式 `.gate()` 没有满足,例如测量值低于 `.gate(minimum)` 的最低值。
|
|
21
|
+
- 有 Attempt 运行出错(`errored`),或计划要跑的 Attempt 没有全部得到结果。
|
|
22
|
+
- 运行被中断,或结果没能保存。
|
|
23
|
+
|
|
24
|
+
计分制评估只要没有 gate 失败,即使得分很低也算成功。想让低分挡住合并,就在评估用例里给对应断言加 `.gate()`。没有全局的 strict 开关,CI 和本地读的是同一份评估源码,判定结果一致。
|
|
25
|
+
|
|
26
|
+
## 运行评估
|
|
12
27
|
|
|
13
28
|
```sh
|
|
14
|
-
|
|
29
|
+
pnpm exec niceeval exp ci --json --junit ./artifacts/niceeval-junit.xml
|
|
15
30
|
```
|
|
16
31
|
|
|
17
|
-
|
|
32
|
+
这条命令给 CI 三样东西:
|
|
18
33
|
|
|
19
|
-
- 退出状态:CI
|
|
20
|
-
-
|
|
21
|
-
- JUnit
|
|
34
|
+
- 退出状态:CI 用它决定这一步成功还是失败。
|
|
35
|
+
- `--json` 的 NDJSON 输出:前面的行描述运行进度和诊断,最后一行是 receipt。
|
|
36
|
+
- JUnit 文件:给 CI 平台读取并展示。
|
|
22
37
|
|
|
23
|
-
JUnit
|
|
38
|
+
JUnit 只是交给 CI 平台的展示格式。判定、用量、断言和诊断仍保存在项目的 `.niceeval/record.sqlite` 里,事后查看都从那里读。
|
|
24
39
|
|
|
25
|
-
## GitHub Actions
|
|
40
|
+
## 在 GitHub Actions 里配置
|
|
26
41
|
|
|
27
|
-
|
|
42
|
+
下面的步骤保存 JSON 输出,同时把 `niceeval exp` 的退出状态正确传回 CI:
|
|
28
43
|
|
|
29
44
|
```yaml
|
|
30
45
|
- name: 运行评估
|
|
31
46
|
shell: bash
|
|
32
47
|
run: |
|
|
33
48
|
set -o pipefail
|
|
34
|
-
|
|
49
|
+
pnpm exec niceeval exp ci --json --junit ./artifacts/niceeval-junit.xml \
|
|
35
50
|
| tee ./artifacts/niceeval.ndjson
|
|
36
51
|
exit "${PIPESTATUS[0]}"
|
|
52
|
+
env:
|
|
53
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
37
54
|
|
|
38
55
|
- name: 上传 JUnit
|
|
39
56
|
if: always()
|
|
@@ -43,19 +60,26 @@ JUnit 和外部平台文件不拥有 Record。Verdict、Usage、断言和诊断
|
|
|
43
60
|
path: ./artifacts/niceeval-junit.xml
|
|
44
61
|
```
|
|
45
62
|
|
|
46
|
-
|
|
63
|
+
没有 `set -o pipefail` 和 `exit "${PIPESTATUS[0]}"` 时,退出状态来自 `tee`,评估失败也不会让 CI 变红。
|
|
47
64
|
|
|
48
|
-
|
|
65
|
+
模型凭据作为 CI secret 注入命令需要的环境变量,例如上面的 `ANTHROPIC_API_KEY`。不要把凭据写进 Experiment、receipt、JUnit 或日志。每个 Agent 读哪个变量见[配置与环境变量](/zh/tutorials/configuration)。
|
|
66
|
+
|
|
67
|
+
## 在后续步骤读取这次的结果
|
|
68
|
+
|
|
69
|
+
运行开始后,NDJSON 的最后一行是 receipt。它的 `receipt.createdRunIds` 列出这次新建的 Run,后续步骤用它打开结果:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
pnpm exec niceeval show --run 01J9ZK3M6P4T7V9X2C5N8QW0RY
|
|
73
|
+
```
|
|
49
74
|
|
|
50
|
-
|
|
75
|
+
要让脚本处理结果,先找到可用的查询,再发送完整 request:
|
|
51
76
|
|
|
52
77
|
```sh
|
|
53
|
-
pnpm exec niceeval query discover
|
|
54
|
-
pnpm exec niceeval view --run 01J9ZK3M6P4T7V9X2C5N8QW0RY --no-open
|
|
78
|
+
pnpm --silent exec niceeval query discover
|
|
55
79
|
```
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
如果命令在运行开始前就因为参数、配置或选择条件出错退出,不会有 receipt,终端会输出 `error:`。这时直接修复命令、Experiment 或选择条件,不要猜测 Run ID。
|
|
58
82
|
|
|
59
|
-
##
|
|
83
|
+
## 让 CI 日志保持可读
|
|
60
84
|
|
|
61
|
-
CI
|
|
85
|
+
CI 日志适合看运行进度和诊断。要细查结果,人在本地用 receipt 里的 Run ID 运行 `niceeval show --run <run-id>` 或 `niceeval view --run <run-id>`;脚本和 AI 先运行 `query discover`。不要把进度和诊断行当作长期保存的结果格式。
|
|
@@ -1,32 +1,59 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "比较两次运行:基线和候选谁更好"
|
|
3
3
|
sidebarTitle: "比较 Run"
|
|
4
|
-
description: "
|
|
4
|
+
description: "固定两次运行的 Run ID,在浏览器里并排审阅,或用 runs.compare 让脚本和 CI 得到逐题配对的比较结果。"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
你在周一跑了一次基线,周三改了 prompt 又跑了一次,想知道这次改动到底让哪些题变好、哪些题变差。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
比较之前先固定两边各是哪一次运行。“最新的结果”会随着下一次运行而变化,拿它当比较对象,今天和明天得出的结论可能不一样。每次 `niceeval exp` 结束时,终端的 `NEXT` 面板都会列出这次新建的 Run ID,把基线和候选的 ID 记下来。
|
|
10
|
+
|
|
11
|
+
## 在浏览器里并排看
|
|
10
12
|
|
|
11
13
|
```sh
|
|
12
|
-
niceeval
|
|
14
|
+
pnpm exec niceeval view --run <baseline-run-id> --run <candidate-run-id>
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
View 会同时打开两个 Run,你可以逐题对照通过与否、分数、耗时和成本,再点进具体某一次运行看对话和工具调用。
|
|
18
|
+
|
|
19
|
+
## 让脚本和 CI 读比较结果
|
|
20
|
+
|
|
21
|
+
自动化流程需要结构化的比较结果时,用 `runs.compare` 请求:
|
|
16
22
|
|
|
17
23
|
```sh
|
|
18
|
-
niceeval query
|
|
19
|
-
|
|
24
|
+
pnpm --silent exec niceeval query run --request - <<'JSON'
|
|
25
|
+
{
|
|
26
|
+
"protocol": "niceeval.query/v1",
|
|
27
|
+
"operation": {
|
|
28
|
+
"kind": "runs.compare",
|
|
29
|
+
"mode": "paired",
|
|
30
|
+
"leftRunIds": ["<baseline-run-id>"],
|
|
31
|
+
"rightRunIds": ["<candidate-run-id>"]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
JSON
|
|
20
35
|
```
|
|
21
36
|
|
|
22
|
-
`
|
|
37
|
+
`mode` 决定怎样对齐两边:
|
|
23
38
|
|
|
24
|
-
|
|
39
|
+
| `mode` | 用在什么时候 |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `side-by-side` | 两边各自给出结果,不算差值。两次运行的题目集合不同、只想并排看时用。 |
|
|
42
|
+
| `exact` | 要求两边的题目集合完全相同,不同就返回具名问题。发布门禁这类必须同口径比较的场景用。 |
|
|
43
|
+
| `paired` | 按同一道题配对,逐题比较。最常用于“这次改动让哪些题变了”。 |
|
|
44
|
+
|
|
45
|
+
比较结果会如实给出两边各自的分母,以及没配上对的题、被排除的题和缺失的结果。缺失不会被当成零分或失败。条件不满足时,你会得到一个说明原因的具名错误,而不是一个看起来正常的数字。
|
|
46
|
+
|
|
47
|
+
先用 `query explain` 检查请求是否合法,再正式运行:
|
|
25
48
|
|
|
26
49
|
```sh
|
|
27
|
-
niceeval
|
|
50
|
+
pnpm --silent exec niceeval query explain --request compare.json
|
|
28
51
|
```
|
|
29
52
|
|
|
30
|
-
|
|
53
|
+
## 比较结果靠得住的前提
|
|
54
|
+
|
|
55
|
+
- 两边跑的是同一批评估用例,每条跑的次数也相近。
|
|
56
|
+
- 两边只差你想比较的那一个变量,写法见[编写实验](/zh/tutorials/write-experiment#比较两个模型)。
|
|
57
|
+
- 看通过率的同时看成本和耗时。通过率高一点、成本却翻倍,不一定值得换。
|
|
31
58
|
|
|
32
|
-
|
|
59
|
+
单次运行结果的读法见[查看运行结果](/zh/tutorials/viewing-results)。
|