modelrig 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +324 -0
- package/README.md +55 -29
- package/data/PROVENANCE.md +14 -0
- package/data/pricing-map.json +26 -0
- package/dist/adapters/attempt-meta-map.d.ts +8 -1
- package/dist/adapters/attempt-meta-map.d.ts.map +1 -1
- package/dist/adapters/attempt-meta-map.js +4 -0
- package/dist/adapters/build-adapters.js +2 -2
- package/dist/adapters/gemini.d.ts +28 -1
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +38 -9
- package/dist/adapters/grok.d.ts.map +1 -1
- package/dist/adapters/grok.js +53 -4
- package/dist/adapters/openai-compat.d.ts +8 -2
- package/dist/adapters/openai-compat.d.ts.map +1 -1
- package/dist/adapters/openai-compat.js +8 -1
- package/dist/adapters/openai-stream.d.ts +10 -2
- package/dist/adapters/openai-stream.d.ts.map +1 -1
- package/dist/adapters/openai-stream.js +5 -1
- package/dist/adapters/openai.d.ts +10 -1
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +57 -7
- package/dist/adapters/responses-api.d.ts +61 -0
- package/dist/adapters/responses-api.d.ts.map +1 -0
- package/dist/adapters/responses-api.js +124 -0
- package/dist/artifacts/artifact.d.ts +31 -12
- package/dist/artifacts/artifact.d.ts.map +1 -1
- package/dist/artifacts/artifact.js +218 -188
- package/dist/artifacts/index.d.ts +15 -5
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +19 -5
- package/dist/artifacts/run-context.d.ts +3 -24
- package/dist/artifacts/run-context.d.ts.map +1 -1
- package/dist/artifacts/run-context.js +3 -39
- package/dist/bakeoff/engine.d.ts +29 -0
- package/dist/bakeoff/engine.d.ts.map +1 -1
- package/dist/bakeoff/engine.js +47 -0
- package/dist/bakeoff/eval-cases-rig.d.ts +36 -0
- package/dist/bakeoff/eval-cases-rig.d.ts.map +1 -0
- package/dist/bakeoff/eval-cases-rig.js +27 -0
- package/dist/bakeoff/eval-cases.d.ts +19 -0
- package/dist/bakeoff/eval-cases.d.ts.map +1 -1
- package/dist/bakeoff/eval-cases.js +18 -1
- package/dist/bakeoff/golden-judge.d.ts +47 -0
- package/dist/bakeoff/golden-judge.d.ts.map +1 -0
- package/dist/bakeoff/golden-judge.js +49 -0
- package/dist/bakeoff/groundedness.d.ts +58 -0
- package/dist/bakeoff/groundedness.d.ts.map +1 -0
- package/dist/bakeoff/groundedness.js +165 -0
- package/dist/bakeoff/quality.d.ts +43 -0
- package/dist/bakeoff/quality.d.ts.map +1 -1
- package/dist/bakeoff/quality.js +31 -0
- package/dist/bakeoff/replay.d.ts +11 -0
- package/dist/bakeoff/replay.d.ts.map +1 -1
- package/dist/bakeoff/replay.js +12 -0
- package/dist/bakeoff/report.d.ts +7 -0
- package/dist/bakeoff/report.d.ts.map +1 -1
- package/dist/bakeoff/report.js +26 -0
- package/dist/cli-judge.d.ts +12 -0
- package/dist/cli-judge.d.ts.map +1 -0
- package/dist/cli-judge.js +48 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +22 -42
- package/dist/config.d.ts +85 -29
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +109 -47
- package/dist/detect/detector.d.ts +4 -2
- package/dist/detect/detector.d.ts.map +1 -1
- package/dist/detect/safe-harbor.d.ts +57 -0
- package/dist/detect/safe-harbor.d.ts.map +1 -0
- package/dist/detect/safe-harbor.js +278 -0
- package/dist/doctor-cli.d.ts +7 -0
- package/dist/doctor-cli.d.ts.map +1 -0
- package/dist/doctor-cli.js +67 -0
- package/dist/doctor-preflight.d.ts +52 -0
- package/dist/doctor-preflight.d.ts.map +1 -0
- package/dist/doctor-preflight.js +112 -0
- package/dist/feedback/coverage.d.ts +11 -8
- package/dist/feedback/coverage.d.ts.map +1 -1
- package/dist/feedback/coverage.js +29 -16
- package/dist/feedback/grade.d.ts +58 -0
- package/dist/feedback/grade.d.ts.map +1 -0
- package/dist/feedback/grade.js +67 -0
- package/dist/gateway/http-protocol.d.ts +20 -1
- package/dist/gateway/http-protocol.d.ts.map +1 -1
- package/dist/gateway/http-protocol.js +1 -1
- package/dist/gateway/serve-client.d.ts +99 -0
- package/dist/gateway/serve-client.d.ts.map +1 -0
- package/dist/gateway/serve-client.js +360 -0
- package/dist/index.d.ts +68 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +167 -46
- package/dist/init/observe-cli.js +1 -1
- package/dist/init/observe.d.ts +2 -2
- package/dist/init/observe.d.ts.map +1 -1
- package/dist/init/observe.js +11 -7
- package/dist/mask/arm.d.ts +112 -0
- package/dist/mask/arm.d.ts.map +1 -0
- package/dist/mask/arm.js +179 -0
- package/dist/mask/index.d.ts +2 -0
- package/dist/mask/index.d.ts.map +1 -1
- package/dist/mask/index.js +7 -1
- package/dist/mask/mask-policy-cli.d.ts +12 -4
- package/dist/mask/mask-policy-cli.d.ts.map +1 -1
- package/dist/mask/mask-policy-cli.js +34 -9
- package/dist/prompts/manifest.d.ts +128 -0
- package/dist/prompts/manifest.d.ts.map +1 -0
- package/dist/prompts/manifest.js +214 -0
- package/dist/prompts/prompt-fetch.d.ts +84 -0
- package/dist/prompts/prompt-fetch.d.ts.map +1 -0
- package/dist/prompts/prompt-fetch.js +120 -0
- package/dist/prompts/prompt-resolve.d.ts +76 -0
- package/dist/prompts/prompt-resolve.d.ts.map +1 -0
- package/dist/prompts/prompt-resolve.js +93 -0
- package/dist/prompts/slot-resolver.d.ts +91 -0
- package/dist/prompts/slot-resolver.d.ts.map +1 -0
- package/dist/prompts/slot-resolver.js +135 -0
- package/dist/prompts/tools-register.d.ts +60 -0
- package/dist/prompts/tools-register.d.ts.map +1 -0
- package/dist/prompts/tools-register.js +48 -0
- package/dist/prompts/version-hash.d.ts +29 -0
- package/dist/prompts/version-hash.d.ts.map +1 -0
- package/dist/prompts/version-hash.js +54 -0
- package/dist/prompts-export-cli.d.ts +21 -0
- package/dist/prompts-export-cli.d.ts.map +1 -0
- package/dist/prompts-export-cli.js +130 -0
- package/dist/query/grammar.d.ts +2 -2
- package/dist/query/grammar.d.ts.map +1 -1
- package/dist/query/grammar.js +3 -1
- package/dist/query/saved.d.ts +13 -0
- package/dist/query/saved.d.ts.map +1 -1
- package/dist/query/saved.js +67 -1
- package/dist/receipts/types.d.ts +1 -1
- package/dist/receipts/types.d.ts.map +1 -1
- package/dist/receipts/types.js +1 -0
- package/dist/registry/build.d.ts +43 -1
- package/dist/registry/build.d.ts.map +1 -1
- package/dist/registry/build.js +52 -0
- package/dist/registry/cache-policy.d.ts.map +1 -1
- package/dist/registry/cache-policy.js +22 -0
- package/dist/registry/pricing-shape.d.ts +67 -8
- package/dist/registry/pricing-shape.d.ts.map +1 -1
- package/dist/registry/pricing-shape.js +50 -13
- package/dist/registry/pricing.d.ts +6 -5
- package/dist/registry/pricing.d.ts.map +1 -1
- package/dist/registry/pricing.js +9 -5
- package/dist/registry/rows.d.ts.map +1 -1
- package/dist/registry/rows.js +1 -0
- package/dist/registry/select.d.ts +6 -1
- package/dist/registry/select.d.ts.map +1 -1
- package/dist/registry/select.js +11 -0
- package/dist/routes/call-config.d.ts +199 -0
- package/dist/routes/call-config.d.ts.map +1 -0
- package/dist/routes/call-config.js +343 -0
- package/dist/routes/destination-loader.d.ts +16 -0
- package/dist/routes/destination-loader.d.ts.map +1 -0
- package/dist/routes/destination-loader.js +29 -0
- package/dist/routes/draft.d.ts +7 -0
- package/dist/routes/draft.d.ts.map +1 -1
- package/dist/routes/draft.js +12 -0
- package/dist/routes/loader.d.ts.map +1 -1
- package/dist/routes/loader.js +31 -56
- package/dist/routes/objective-loader.d.ts +12 -0
- package/dist/routes/objective-loader.d.ts.map +1 -1
- package/dist/routes/objective-loader.js +82 -0
- package/dist/routes/output-loader.d.ts +42 -0
- package/dist/routes/output-loader.d.ts.map +1 -0
- package/dist/routes/output-loader.js +112 -0
- package/dist/routes/prompt-loader.d.ts +49 -0
- package/dist/routes/prompt-loader.d.ts.map +1 -0
- package/dist/routes/prompt-loader.js +113 -0
- package/dist/routes/resolved-bundle.d.ts +69 -0
- package/dist/routes/resolved-bundle.d.ts.map +1 -1
- package/dist/routes/resolved-bundle.js +76 -0
- package/dist/routes/screen-loader.d.ts +29 -1
- package/dist/routes/screen-loader.d.ts.map +1 -1
- package/dist/routes/screen-loader.js +59 -1
- package/dist/run/accept.d.ts +5 -0
- package/dist/run/accept.d.ts.map +1 -1
- package/dist/run/accept.js +2 -0
- package/dist/run/cost.d.ts +31 -2
- package/dist/run/cost.d.ts.map +1 -1
- package/dist/run/cost.js +57 -2
- package/dist/run/destination.d.ts +39 -0
- package/dist/run/destination.d.ts.map +1 -0
- package/dist/run/destination.js +45 -0
- package/dist/run/dispatch.d.ts +67 -16
- package/dist/run/dispatch.d.ts.map +1 -1
- package/dist/run/dispatch.js +133 -29
- package/dist/run/grounding.d.ts +28 -2
- package/dist/run/grounding.d.ts.map +1 -1
- package/dist/run/grounding.js +54 -10
- package/dist/run/raw-defaults.d.ts.map +1 -1
- package/dist/run/raw-defaults.js +6 -1
- package/dist/run/raw-finalize.d.ts +50 -0
- package/dist/run/raw-finalize.d.ts.map +1 -0
- package/dist/run/raw-finalize.js +266 -0
- package/dist/run/raw-knobs.d.ts +36 -0
- package/dist/run/raw-knobs.d.ts.map +1 -0
- package/dist/run/raw-knobs.js +99 -0
- package/dist/run/raw-request.d.ts +24 -0
- package/dist/run/raw-request.d.ts.map +1 -0
- package/dist/run/raw-request.js +69 -0
- package/dist/run/raw-schema.d.ts +76 -0
- package/dist/run/raw-schema.d.ts.map +1 -0
- package/dist/run/raw-schema.js +166 -0
- package/dist/run/raw-search-cost.d.ts +48 -0
- package/dist/run/raw-search-cost.d.ts.map +1 -0
- package/dist/run/raw-search-cost.js +78 -0
- package/dist/run/raw-support.d.ts +64 -6
- package/dist/run/raw-support.d.ts.map +1 -1
- package/dist/run/raw-support.js +84 -11
- package/dist/run/raw.d.ts +25 -26
- package/dist/run/raw.d.ts.map +1 -1
- package/dist/run/raw.js +30 -351
- package/dist/run/record-attempt.d.ts +12 -0
- package/dist/run/record-attempt.d.ts.map +1 -1
- package/dist/run/record-attempt.js +30 -12
- package/dist/run/repair-attempt.d.ts +68 -0
- package/dist/run/repair-attempt.d.ts.map +1 -0
- package/dist/run/repair-attempt.js +180 -0
- package/dist/run/resolve-destination.d.ts +49 -0
- package/dist/run/resolve-destination.d.ts.map +1 -0
- package/dist/run/resolve-destination.js +76 -0
- package/dist/run/routing-docs.d.ts.map +1 -1
- package/dist/run/routing-docs.js +10 -5
- package/dist/run/run.d.ts +30 -1
- package/dist/run/run.d.ts.map +1 -1
- package/dist/run/run.js +94 -172
- package/dist/run/telemetry-row.d.ts +92 -0
- package/dist/run/telemetry-row.d.ts.map +1 -0
- package/dist/run/telemetry-row.js +81 -0
- package/dist/run/validate.d.ts +12 -1
- package/dist/run/validate.d.ts.map +1 -1
- package/dist/run/validate.js +31 -0
- package/dist/run/web-search-pricing.d.ts +43 -0
- package/dist/run/web-search-pricing.d.ts.map +1 -0
- package/dist/run/web-search-pricing.js +56 -0
- package/dist/savings/odometer.d.ts +4 -0
- package/dist/savings/odometer.d.ts.map +1 -1
- package/dist/savings/odometer.js +20 -1
- package/dist/savings/swap-execute.d.ts +7 -0
- package/dist/savings/swap-execute.d.ts.map +1 -1
- package/dist/savings/swap-execute.js +30 -0
- package/dist/savings/swaps-client.d.ts +10 -0
- package/dist/savings/swaps-client.d.ts.map +1 -1
- package/dist/screen/fixtures/probe-corpora.d.ts +23 -0
- package/dist/screen/fixtures/probe-corpora.d.ts.map +1 -0
- package/dist/screen/fixtures/probe-corpora.js +69 -0
- package/dist/screen/index.d.ts +21 -0
- package/dist/screen/index.d.ts.map +1 -0
- package/dist/screen/index.js +64 -0
- package/dist/screen/model-screen.d.ts +111 -0
- package/dist/screen/model-screen.d.ts.map +1 -0
- package/dist/screen/model-screen.js +178 -0
- package/dist/screen/patterns.d.ts +51 -0
- package/dist/screen/patterns.d.ts.map +1 -0
- package/dist/screen/patterns.js +151 -0
- package/dist/screen/phi-gate.d.ts +52 -0
- package/dist/screen/phi-gate.d.ts.map +1 -0
- package/dist/screen/phi-gate.js +86 -0
- package/dist/screen/policy.d.ts +71 -0
- package/dist/screen/policy.d.ts.map +1 -0
- package/dist/screen/policy.js +334 -0
- package/dist/screen/probe.d.ts +118 -0
- package/dist/screen/probe.d.ts.map +1 -0
- package/dist/screen/probe.js +132 -0
- package/dist/screen/screen-cli.d.ts +16 -0
- package/dist/screen/screen-cli.d.ts.map +1 -0
- package/dist/screen/screen-cli.js +178 -0
- package/dist/screen/screen.d.ts +99 -0
- package/dist/screen/screen.d.ts.map +1 -0
- package/dist/screen/screen.js +0 -0
- package/dist/screen/sidecar.d.ts +69 -0
- package/dist/screen/sidecar.d.ts.map +1 -0
- package/dist/screen/sidecar.js +145 -0
- package/dist/screen/types.d.ts +43 -2
- package/dist/screen/types.d.ts.map +1 -1
- package/dist/settings/api-fetcher.d.ts +14 -3
- package/dist/settings/api-fetcher.d.ts.map +1 -1
- package/dist/settings/api-fetcher.js +61 -10
- package/dist/settings/grading-guide.d.ts +102 -0
- package/dist/settings/grading-guide.d.ts.map +1 -0
- package/dist/settings/grading-guide.js +23 -0
- package/dist/settings/index.d.ts +3 -2
- package/dist/settings/index.d.ts.map +1 -1
- package/dist/settings/index.js +2 -1
- package/dist/settings/task-settings.d.ts +44 -7
- package/dist/settings/task-settings.d.ts.map +1 -1
- package/dist/settings/task-settings.js +53 -12
- package/dist/status.d.ts +32 -20
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +51 -30
- package/dist/telemetry/artifact-store.d.ts +5 -6
- package/dist/telemetry/artifact-store.d.ts.map +1 -1
- package/dist/telemetry/artifact-store.js +21 -24
- package/dist/telemetry/attempt-meta.d.ts +76 -1
- package/dist/telemetry/attempt-meta.d.ts.map +1 -1
- package/dist/telemetry/attempt-meta.js +33 -1
- package/dist/telemetry/exporter-setup.d.ts +2 -0
- package/dist/telemetry/exporter-setup.d.ts.map +1 -1
- package/dist/telemetry/exporter-setup.js +6 -1
- package/dist/telemetry/exporter.d.ts +2 -2
- package/dist/telemetry/exporter.d.ts.map +1 -1
- package/dist/telemetry/exporter.js +22 -41
- package/dist/telemetry/grade-mappers.d.ts +25 -0
- package/dist/telemetry/grade-mappers.d.ts.map +1 -0
- package/dist/telemetry/grade-mappers.js +64 -0
- package/dist/telemetry/grades-sql.d.ts +56 -0
- package/dist/telemetry/grades-sql.d.ts.map +1 -0
- package/dist/telemetry/grades-sql.js +156 -0
- package/dist/telemetry/ingest-protocol.d.ts +55 -48
- package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
- package/dist/telemetry/ingest-protocol.js +48 -83
- package/dist/telemetry/org-identity.d.ts +44 -0
- package/dist/telemetry/org-identity.d.ts.map +1 -0
- package/dist/telemetry/org-identity.js +98 -0
- package/dist/telemetry/route-registration.d.ts +48 -0
- package/dist/telemetry/route-registration.d.ts.map +1 -0
- package/dist/telemetry/route-registration.js +77 -0
- package/dist/telemetry/sinks.d.ts +10 -1
- package/dist/telemetry/sinks.d.ts.map +1 -1
- package/dist/telemetry/sinks.js +52 -6
- package/dist/telemetry/store-migrations.d.ts.map +1 -1
- package/dist/telemetry/store-migrations.js +64 -0
- package/dist/telemetry/store.d.ts +9 -6
- package/dist/telemetry/store.d.ts.map +1 -1
- package/dist/telemetry/store.js +8 -50
- package/dist/tenancy/api-key-format.d.ts +45 -1
- package/dist/tenancy/api-key-format.d.ts.map +1 -1
- package/dist/tenancy/api-key-format.js +50 -1
- package/dist/types/provider.d.ts +23 -3
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/provider.js +26 -0
- package/dist/types/route.d.ts +154 -2
- package/dist/types/route.d.ts.map +1 -1
- package/dist/types/telemetry.d.ts +73 -48
- package/dist/types/telemetry.d.ts.map +1 -1
- package/dist/validate-cli.d.ts.map +1 -1
- package/dist/validate-cli.js +32 -0
- package/dist/verify/verify.d.ts +5 -0
- package/dist/verify/verify.d.ts.map +1 -1
- package/dist/verify/verify.js +2 -0
- package/dist/watch/evaluate.d.ts +84 -1
- package/dist/watch/evaluate.d.ts.map +1 -1
- package/dist/watch/evaluate.js +28 -0
- package/dist/watch/monitor.d.ts +8 -2
- package/dist/watch/monitor.d.ts.map +1 -1
- package/dist/watch/monitor.js +13 -5
- package/dist/watch/regret-monitor-cli.d.ts +16 -0
- package/dist/watch/regret-monitor-cli.d.ts.map +1 -0
- package/dist/watch/regret-monitor-cli.js +137 -0
- package/dist/watch/regret-monitor.d.ts +168 -0
- package/dist/watch/regret-monitor.d.ts.map +1 -0
- package/dist/watch/regret-monitor.js +304 -0
- package/dist/watch/upgrade.d.ts +62 -0
- package/dist/watch/upgrade.d.ts.map +1 -0
- package/dist/watch/upgrade.js +57 -0
- package/docs/agent-skill/SKILL.md +181 -9
- package/docs/how-it-fits.md +3 -2
- package/docs/instrumentation.md +219 -46
- package/docs/llms.txt +158 -35
- package/docs/managed-serving.md +150 -0
- package/docs/mcp-oracle.md +322 -0
- package/docs/migration-playbook.md +5 -4
- package/docs/quickstart.md +263 -89
- package/package.json +18 -4
- package/registry/leaderboard.json +74 -0
- package/registry/registry.json +232 -112
- package/screen.d.ts +16 -0
- package/templates/call-disposition-qa.json +77 -0
- package/templates/catalog-cleansing.json +77 -0
- package/templates/compliance-review.json +76 -0
- package/templates/cs-next-action.json +76 -0
- package/templates/document-extraction.json +78 -0
- package/templates/financial-classification.json +75 -0
- package/templates/lead-qualification.json +76 -0
- package/templates/medical-classification.json +71 -0
- package/templates/ticket-triage.json +76 -0
- package/dist/feedback/feedback.d.ts +0 -35
- package/dist/feedback/feedback.d.ts.map +0 -1
- package/dist/feedback/feedback.js +0 -39
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"use_case": "medical-classification",
|
|
3
|
+
"title": "Medical classification",
|
|
4
|
+
"summary": "Classify a clinical document into your own categories — document type, specialty, coding bucket — and hand off the ones a qualified person must review. It sorts documents; it does not make clinical decisions.",
|
|
5
|
+
"fit_note": "Medical classification fits the shipped teach → calibrate → grade → optimize loop when four conditions hold. (1) Your categories and the documents you classify are stable enough that last quarter's examples still describe this quarter's — if the taxonomy is still moving, settle it before you calibrate. (2) Someone who owns the process can write down what a correct classification is, which is the grading guide below. (3) A qualified reviewer can grade a batch of past documents against the calls they would have made, so a grader can be calibrated against them. (4) You process enough documents that calibration and optimization pay back. This task handles protected health information, so the custody terms come first — quoted verbatim from the published content custody terms: \"Do not send protected health information or other regulated data through ModelRig until a BAA or DPA is in place. This service is not offered for regulated data today, and nothing on this page should be read as agreeing to handle it.\" Until those terms are in place, the today-path is to run this on a zero-retention route (or with content custody turned off), so ModelRig holds no content and grading is limited to the scores and metadata your own systems send. The full terms are at https://modelrig.ai/terms/content-custody. This template sorts documents into your categories; it is not a diagnostic or clinical-decision tool, and it makes no claim about how well any model classifies your documents — that is what your goldens and grades measure — and no compliance claim of any other kind.",
|
|
6
|
+
"starter_schema": {
|
|
7
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
8
|
+
"$comment": "STARTER SCHEMA. Replace every TODO with your own taxonomy before use. The template runs as-is: free-text fields validate immediately. TODO markers show where adding your own enum values tightens grading to your categories; do not copy example words from the docs.",
|
|
9
|
+
"title": "MedicalClassification",
|
|
10
|
+
"type": "object",
|
|
11
|
+
"additionalProperties": false,
|
|
12
|
+
"required": ["classification", "needs_human"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"classification": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "The category this clinical document belongs in. TODO(enum): constrain this to YOUR own category labels by adding an \"enum\": [ ... ] here. It runs as free text immediately; add your own enum values here to tighten validation and grading to your taxonomy.",
|
|
17
|
+
"$comment": "TODO(enum): add your document categories as the enum for this field."
|
|
18
|
+
},
|
|
19
|
+
"needs_human": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "True when the document is ambiguous, clinically significant, or otherwise a call a qualified person must make. Pairs with the escalation band in the grading guide."
|
|
22
|
+
},
|
|
23
|
+
"rationale": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "One or two sentences grounding the classification in what the document actually contains. Optional; keep it if you want the grader to check the decision is explained."
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"starter_guide": {
|
|
30
|
+
"criteria": [
|
|
31
|
+
{
|
|
32
|
+
"id": "classification-correct",
|
|
33
|
+
"title": "Classification is correct",
|
|
34
|
+
"pass": "the document gets the category a qualified reviewer on your team would have chosen for it, by your own rules.",
|
|
35
|
+
"fail": "The document is classified into a category that does not match what it actually is, or into a catch-all when a specific category fits."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "grounded-no-invention",
|
|
39
|
+
"title": "Decision is grounded in the document",
|
|
40
|
+
"pass": "every part of the classification is supported by something the document actually contains; no clinical detail is invented.",
|
|
41
|
+
"fail": "The output asserts a diagnosis, a code, or a finding that the document does not contain."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "stays-a-classification",
|
|
45
|
+
"title": "Output stays a classification, not a clinical judgment",
|
|
46
|
+
"pass": "the output sorts the document into your categories and stops there, without offering a diagnosis or a treatment decision.",
|
|
47
|
+
"fail": "The output makes a clinical or diagnostic call the task is not meant to make, rather than classifying and deferring to a person."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "human-flag-when-unsure",
|
|
51
|
+
"title": "Ambiguous or clinically significant documents are flagged for a human",
|
|
52
|
+
"pass": "a document that is genuinely ambiguous or clinically significant sets needs_human rather than being auto-classified.",
|
|
53
|
+
"fail": "A document a qualified reviewer would have handled is classified automatically with false confidence."
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"teach_grade_ids": [],
|
|
57
|
+
"escalation": {
|
|
58
|
+
"epsilon": 0.1
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"golden_checklist": [
|
|
62
|
+
"One clear example per category in your taxonomy — the ordinary, unambiguous document for each category.",
|
|
63
|
+
"The two or three categories your team most often confuses, side by side, so the guide learns the boundary between them.",
|
|
64
|
+
"A document that spans two categories at once — the golden fixes which one wins and why.",
|
|
65
|
+
"A clinically significant document that should reach a qualified person regardless of category — the golden shows needs_human set.",
|
|
66
|
+
"A document that tempts a clinical judgment — the golden shows it classified and deferred, not diagnosed.",
|
|
67
|
+
"An illegible, truncated, or off-type document — the golden shows it flagged for a human rather than force-classified.",
|
|
68
|
+
"Aim for roughly twenty goldens total, weighted toward the ambiguous, cross-category, and clinically significant documents rather than the routine centre."
|
|
69
|
+
],
|
|
70
|
+
"escalation_starter": "Start by escalating to a qualified person whenever the model sets needs_human, and always for clinically significant documents regardless of the classification. The machine-side band lives in starter_guide.escalation.epsilon: a grade within that distance of your route's pass threshold is treated as judge-uncertain and sent to the review queue. The 0.1 here is a starting band — keep it wide until a qualified reviewer has graded enough documents to trust the grader, then narrow it."
|
|
71
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"use_case": "ticket-triage",
|
|
3
|
+
"title": "Ticket triage",
|
|
4
|
+
"summary": "Classify an incoming support ticket into your own categories and a priority, and flag the ones a human should look at.",
|
|
5
|
+
"fit_note": "Ticket triage fits the shipped teach → calibrate → grade → optimize loop when four conditions hold. (1) Your ticket stream is stable enough that last month's examples still describe this month's — if your categories churn weekly, tighten them before you calibrate. (2) Your support team can write down what a correct routing decision is, which is the grading guide below. (3) Someone who knows the queue can grade a batch of past tickets so a grader can be calibrated against them. (4) The queue carries enough volume that calibration and optimization pay back. This template is a starting point for each of those, not a claim that triage is solved — fill in your taxonomy and your definitions before you rely on it.",
|
|
6
|
+
"starter_schema": {
|
|
7
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
8
|
+
"$comment": "STARTER SCHEMA. Replace every TODO with your own taxonomy before use. The template runs as-is: free-text fields validate immediately. TODO markers show where adding your own enum values tightens grading to your taxonomy; do not copy example words from the docs.",
|
|
9
|
+
"title": "TicketTriage",
|
|
10
|
+
"type": "object",
|
|
11
|
+
"additionalProperties": false,
|
|
12
|
+
"required": ["category", "priority", "needs_human"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"category": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "Which queue or team the ticket belongs to. TODO(enum): constrain this to YOUR own category labels by adding an \"enum\": [ ... ] here. It runs as free text immediately; add your own enum values here to tighten validation and grading to your taxonomy.",
|
|
17
|
+
"$comment": "TODO(enum): add your category labels as the enum for this field."
|
|
18
|
+
},
|
|
19
|
+
"priority": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "How urgently the ticket needs attention. TODO(enum): add an \"enum\": [ ... ] with YOUR priority levels (whatever your team already uses).",
|
|
22
|
+
"$comment": "TODO(enum): add your priority levels as the enum for this field."
|
|
23
|
+
},
|
|
24
|
+
"needs_human": {
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"description": "True when the model is not confident enough to route this automatically and a person should decide. Pairs with the escalation band in the grading guide."
|
|
27
|
+
},
|
|
28
|
+
"reason": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "One short sentence grounding the category and priority in the ticket text. Optional; keep it if you want the grader to check that the decision is explained."
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"starter_guide": {
|
|
35
|
+
"criteria": [
|
|
36
|
+
{
|
|
37
|
+
"id": "category-correct",
|
|
38
|
+
"title": "Category is correct",
|
|
39
|
+
"pass": "the ticket is assigned to the category a human on your queue would have chosen for it.",
|
|
40
|
+
"fail": "The ticket is assigned to a category that does not match its actual topic, or to a catch-all when a specific category fits."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "priority-justified",
|
|
44
|
+
"title": "Priority matches the stated impact",
|
|
45
|
+
"pass": "the priority reflects the urgency and impact the ticket actually describes, by your team's own priority rules.",
|
|
46
|
+
"fail": "The priority is higher or lower than the ticket's stated impact warrants."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "grounded-no-invention",
|
|
50
|
+
"title": "Decision is grounded in the ticket",
|
|
51
|
+
"pass": "Every field is supported by something the ticket actually says; nothing is invented.",
|
|
52
|
+
"fail": "The output asserts a detail (a product, an account state, an error) that the ticket text does not contain."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "human-flag-when-unsure",
|
|
56
|
+
"title": "Ambiguous tickets are flagged for a human",
|
|
57
|
+
"pass": "a ticket that is genuinely ambiguous, mixed-topic, or high-risk sets needs_human rather than guessing a single category.",
|
|
58
|
+
"fail": "A ticket that a human would have hesitated on is auto-routed with false confidence."
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"teach_grade_ids": [],
|
|
62
|
+
"escalation": {
|
|
63
|
+
"epsilon": 0.1
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"golden_checklist": [
|
|
67
|
+
"One clear example per category in your taxonomy — the ordinary, unambiguous case for each queue.",
|
|
68
|
+
"The two or three categories your team most often confuses, side by side, so the guide learns the boundary between them.",
|
|
69
|
+
"A multi-topic ticket that could plausibly land in two categories — the golden records which one wins and why.",
|
|
70
|
+
"A high-priority case and a low-priority case that use similar words, so priority is judged on impact, not vocabulary.",
|
|
71
|
+
"An edge case: an empty, spam, or unintelligible ticket — the golden shows it flagged for a human rather than force-categorized.",
|
|
72
|
+
"A sensitive case (security, legal, billing dispute, or churn risk) that should escalate regardless of category.",
|
|
73
|
+
"Aim for roughly twenty goldens total, weighted toward the boundaries above rather than the easy centre of each category."
|
|
74
|
+
],
|
|
75
|
+
"escalation_starter": "Start by escalating to a human whenever the model sets needs_human, and whenever a ticket is sensitive (security, legal, or a churn/at-risk signal) regardless of its category. The machine-side band lives in starter_guide.escalation.epsilon: a grade within that distance of your route's pass threshold is treated as judge-uncertain and sent to the human queue. The 0.1 here is a starting band — widen it while you build trust, narrow it as your grader calibrates."
|
|
76
|
+
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* rig.feedback() — Phase 4 WS2 (spec: judgment starts accumulating).
|
|
3
|
-
* The SDK surface normalizes a target (inference id or {episode}) + opts
|
|
4
|
-
* into a FeedbackRow; the write is a synchronous local SQLite insert
|
|
5
|
-
* (fire-and-forget from the caller's view — no network, never throws for
|
|
6
|
-
* sink reasons). The Supabase mirror rides the exporter, dual-store style.
|
|
7
|
-
*/
|
|
8
|
-
import type { FeedbackRow } from "../types/telemetry";
|
|
9
|
-
export type FeedbackTarget = string | {
|
|
10
|
-
readonly episode: string;
|
|
11
|
-
};
|
|
12
|
-
export interface FeedbackOpts {
|
|
13
|
-
readonly verdict: "up" | "down";
|
|
14
|
-
/** Optional graded signal in [0, 1]; verdict remains the primary axis. */
|
|
15
|
-
readonly score?: number;
|
|
16
|
-
readonly note?: string;
|
|
17
|
-
/** Who judged: "sdk" (default), a review-agent name, "human", … */
|
|
18
|
-
readonly source?: string;
|
|
19
|
-
/**
|
|
20
|
-
* The org this verdict belongs to (Phase 6 WS2). Omit from application code
|
|
21
|
-
* — a rig has one org and the exporter knows it.
|
|
22
|
-
*
|
|
23
|
-
* Supplied by modelrig-server, and only ever with an org it has ALREADY
|
|
24
|
-
* authorized the caller into: a value that arrived in a request body and was
|
|
25
|
-
* passed through here would be a tenant chosen by the client (T3). Setting
|
|
26
|
-
* it is what lets one hosted server hold verdicts for many orgs without
|
|
27
|
-
* misfiling any of them (QA-P6-010).
|
|
28
|
-
*/
|
|
29
|
-
readonly orgId?: string;
|
|
30
|
-
/** Authenticated user who recorded it. Same provenance rule as `orgId`:
|
|
31
|
-
* resolved from a session, never read off a request body. */
|
|
32
|
-
readonly createdBy?: string | null;
|
|
33
|
-
}
|
|
34
|
-
export declare function buildFeedbackRow(target: FeedbackTarget, opts: FeedbackOpts): FeedbackRow;
|
|
35
|
-
//# sourceMappingURL=feedback.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../src/feedback/feedback.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,IAAI,GAAG,MAAM,CAAC;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;iEAC6D;IAC7D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,GAAG,WAAW,CA0BxF"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* rig.feedback() — Phase 4 WS2 (spec: judgment starts accumulating).
|
|
4
|
-
* The SDK surface normalizes a target (inference id or {episode}) + opts
|
|
5
|
-
* into a FeedbackRow; the write is a synchronous local SQLite insert
|
|
6
|
-
* (fire-and-forget from the caller's view — no network, never throws for
|
|
7
|
-
* sink reasons). The Supabase mirror rides the exporter, dual-store style.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.buildFeedbackRow = buildFeedbackRow;
|
|
11
|
-
const node_crypto_1 = require("node:crypto");
|
|
12
|
-
function buildFeedbackRow(target, opts) {
|
|
13
|
-
let inferenceId = null;
|
|
14
|
-
let episodeKey = null;
|
|
15
|
-
if (typeof target === "string") {
|
|
16
|
-
inferenceId = target;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
episodeKey = target.episode;
|
|
20
|
-
}
|
|
21
|
-
if ((inferenceId === null || inferenceId === "") && (episodeKey === null || episodeKey === "")) {
|
|
22
|
-
throw new Error("feedback target must be a non-empty inference id or {episode}");
|
|
23
|
-
}
|
|
24
|
-
if (opts.score !== undefined && (!Number.isFinite(opts.score) || opts.score < 0 || opts.score > 1)) {
|
|
25
|
-
throw new Error(`feedback score must be in [0, 1], got ${opts.score}`);
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
id: (0, node_crypto_1.randomUUID)(),
|
|
29
|
-
ts: new Date().toISOString(),
|
|
30
|
-
inferenceId,
|
|
31
|
-
episodeKey,
|
|
32
|
-
verdict: opts.verdict,
|
|
33
|
-
score: opts.score ?? null,
|
|
34
|
-
note: opts.note ?? null,
|
|
35
|
-
source: opts.source ?? "sdk",
|
|
36
|
-
orgId: opts.orgId !== undefined && opts.orgId !== "" ? opts.orgId : null,
|
|
37
|
-
createdBy: opts.createdBy ?? null,
|
|
38
|
-
};
|
|
39
|
-
}
|