Skip to content

Decisions and confidence

Laya evaluates all decisions in a workflow together in a single model call. Each result preserves the normalized answer and the raw backend answer.

Primitive Definition Normalized value
one_of At least two named options with descriptions Selected option name
whether A yes/no question Boolean; true when P(true) ≥ 0.5
scale At least two ordered levels Fractional, zero-based expected rubric position
decisions:
urgent:
decide: whether
question: Does this ticket need immediate attention?
severity:
decide: scale
question: How severe is the customer impact?
levels:
- negligible
- minor
- significant
- critical

A scale result can fall between levels. For the four levels above, its value lies between 0 and 3; it is not necessarily an integer label.

Rules can read value, probability, confidence, and accepted where supported. Probability distributions and raw answers are also preserved in execution results.

For whether, probability is P(true), including when the boolean value is false. scale.probability is unavailable. Laya’s whether answers do not provide confidence: compare their probability directly instead.

Reading unavailable metadata raises an error. Do not assume all backends provide every field.

Add an inclusive threshold to a decision:

decisions:
department:
decide: one_of
question: Which team should handle this ticket?
options:
billing: Payments and invoices
support: Product problems
confidence:
minimum: 0.75
flow:
- when: department.accepted == false
do: return
value:
route: human_review
- else:
do: return
value:
route: "{{ department.value }}"

accepted is true when confidence meets the configured minimum. Missing confidence fails the policy. Without a policy, accepted is true.

A policy does not retry inference, make a second call, or automatically route the result. Your flow decides what happens after a failed policy. Choose thresholds using representative inputs; they are not universal quality guarantees.

Keep inputs and option lists short. Laya’s English checkpoint has a 512-token context window including question headers, and long input may be truncated. Review the Laya project for model details.