Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

docs(sdk): document the answer confidence and abstention fields

Aashish83a3bd4d0c5e
diff --git a/docs/typescript-sdk.md b/docs/typescript-sdk.md
index b2c94f14..fe5ca46d 100644
--- a/docs/typescript-sdk.md
+++ b/docs/typescript-sdk.md
@@ -39,6 +39,11 @@ before transport.
Responses preserve `model`, `answers`, and token `usage`. Laya's `routing` and
answer `action` fields are optional extensions; Noul confidence is optional too.
Choice and Score confidence, distributions, and Score legends remain required.
+Every answer carries `answer_confidence`, the `max(p)` mass on the reported answer,
+which is the same quantity on all three question types. A call that passed
+`min_confidence` reports `abstention` and `abstention_threshold` on each of its
+answers and `low_confidence: true` on the ones below the threshold; with no
+threshold set, none of those three keys are sent, and that absence is the report.
Optional extensions are validated when present.
`/v1/systemone` does not expose Python's standalone routing method or `task` and
diff --git a/sdk/typescript/README.md b/sdk/typescript/README.md
index 4fa747c5..c154babc 100644
--- a/sdk/typescript/README.md
+++ b/sdk/typescript/README.md
@@ -117,6 +117,9 @@ result.answers.urgency.score; // number: expected rubric index, from 0 to 2
result.answers.refund.noul; // number: P(true), from 0 to 1
result.answers.department.probabilities.billing;
result.answers.department.confidence;
+result.answers.department.answer_confidence; // number: max(p), the same quantity on every type
+result.answers.urgency.abstention; // 'passed' | 'abstained' | 'unevaluated', with minConfidence
+result.answers.urgency.low_confidence; // true only on an answer that fell below it
result.answers.department.action?.act_probability; // Laya-only metadata
result.usage.input_tokens;
```
@@ -170,7 +173,12 @@ automatic workflow routing.
Laya returns `model`, `answers`, and `usage`, with optional `routing`, answer
`action`, and Noul `confidence` metadata. Those fields are validated when
-present. Choice and Score confidence remains required. `health()` is never
+present. Choice and Score confidence remains required. Every answer also carries
+`answer_confidence` (`max(p)`), the one confidence that means the same thing on all
+three question types; when you pass `minConfidence`, each answer of that call additionally
+reports `abstention` and `abstention_threshold`, and the ones below the threshold carry
+`low_confidence: true`. With `minConfidence` unset none of those three keys appear — absence is
+how a caller tells an ungated run from a cleared gate. `health()` is never
called by `predict()`.
## Which JavaScript client?