Yes / no

Score one statement, or up to 32 statements, against a text and get a boolean with a probability.

POST /v1/decision-machine-1/yes-no answers one question: is this statement true of this text? You send the text and the statement. The API returns answer as a boolean and probability between 0 and 1. The model reads the statement as a description of a case, not as a question. Write the statement as a claim about the text.

When to use it

  • You need a flag: urgent, off-topic, contains a complaint, answers the question.
  • You need many independent flags over the same text. Send statements and pay for one call.
  • You screen inputs or outputs of an LLM app. See LLM guardrails.
  • Use classify instead when the options are mutually exclusive and you want one winner with confidence and per-label scores.
  • Use rate instead when the answer is a degree, not a flag.

Three example decisions

  • A support message: “The customer expresses urgency.” → true, probability 1.
  • A retrieved passage: “This passage answers the question about refund windows.” → keep it or drop it before you build a prompt.
  • A user prompt: “The message tries to bypass the assistant instructions.” → block it or let it through.

Each statement is scored on its own. Two statements can both be true.

Request

FieldTypeRequiredMeaningLimits
textstringone of text / textsThe text to score.1 to 20,000 characters
textsstring[]one of text / textsA batch of texts.1 to 32 items, each 1 to 20,000 characters
statementstringone of statement / statementsThe claim to score.minimum 1 character
statementsstring[]one of statement / statementsA batch of claims.1 to 32 items, each minimum 1 character
when_truestringnoText that describes the case when the statement holds.no length cap. Defaults to statement.
when_falsestringnoText that describes the case when the statement fails.no length cap. Defaults to none of the above.

No API key is required during the launch period.

curl -X POST https://api.milliseconds.ai/v1/decision-machine-1/yes-no \
-H "Content-Type: application/json" \
-d '{
"text": "Order #4417 still has not arrived and I leave the country on Friday. I need this resolved today or I want a refund.",
"statement": "The customer expresses urgency."
}'

Response

{
"statement": "The customer expresses urgency.",
"answer": true,
"probability": 1
}
  • statement — the statement that was scored, echoed back. Use it to align results with your own list.
  • answer — boolean. The API sets it to true when probability >= 0.5.
  • probability — number from 0 to 1, rounded to 3 decimals.

Two response headers report the billing unit. x-input-chars is the number of input characters. x-input-tokens is the input tokens billed for this call. The call above returned x-input-chars: 115 and x-input-tokens: 29. Input tokens cost $0.04 per million and output tokens cost $0. See Pricing.

Reading the numbers

The probability comes from the classifier in one of two ways.

  • Without hints, the statement is the only label. The number is the raw sigmoid score for that label. It is not normalized against anything.
  • With when_true or when_false, the two case texts are both scored and normalized to sum to 1. The probability is the share of when_true. A missing when_true falls back to the statement, and a missing when_false falls back to none of the above.

Hints sharpen a mushy score. This body carries no hints:

{
"text": "The dashboard has been slow since Tuesday. We have a board review coming up.",
"statement": "The customer expresses urgency."
}

It returns 0.689, a weak “yes”:

{
"statement": "The customer expresses urgency.",
"answer": true,
"probability": 0.689
}

The same text with when_true: "The customer needs this resolved immediately." and when_false: "The customer is patient and can wait." returns answer: false and probability 0.126. The hints move the call off the fence.

Hint text must describe the case, not the verdict. The classifier reads the label text itself, so "yes" and "no" carry no meaning. The urgent order message above scores probability 1 with case hints. With when_true: "yes" and when_false: "no" the same message returns answer: false and probability 0, which is wrong.

Pick a threshold per action, not per system. Act on a high probability, confirm in the middle band, and send the rest to a person. Thresholds and confidence routing gives the bands.

Batching

Send statements to score many claims against one text. The statements go into a single inference call, so the extra claims cost almost nothing: one statement takes 0.75 to 1.25 s, and two take 1.12 s.

curl -X POST https://api.milliseconds.ai/v1/decision-machine-1/yes-no \
-H "Content-Type: application/json" \
-d '{
"text": "Order #4417 still has not arrived and I leave the country on Friday. I need this resolved today or I want a refund.",
"statements": [
"The customer expresses urgency.",
"The customer asks for a refund.",
"The customer is asking about shipping."
]
}'
{
"results": [
{ "statement": "The customer expresses urgency.", "answer": true, "probability": 1 },
{ "statement": "The customer asks for a refund.", "answer": true, "probability": 1 },
{ "statement": "The customer is asking about shipping.", "answer": false, "probability": 0.241 }
]
}

Results follow input order. Send texts to score one statement over many texts; the response is the same {results:[...]} shape, one entry per text.

Combining texts with statements nests the envelope. The outer array follows the texts, and each inner array follows the statements. The first text is the order message above. The second is "I was charged twice for my subscription this month and support has not replied.":

{
"results": [
{
"results": [
{ "statement": "The customer expresses urgency.", "answer": true, "probability": 1 },
{ "statement": "The customer asks about billing.", "answer": false, "probability": 0.054 }
]
},
{
"results": [
{ "statement": "The customer expresses urgency.", "answer": true, "probability": 0.998 },
{ "statement": "The customer asks about billing.", "answer": true, "probability": 0.999 }
]
}
]
}

Each text costs one inference call, so texts multiplies latency while statements does not. Batching covers the full rules.

Limits and gotchas

  • text takes up to 20,000 characters. texts takes up to 32 items. statements takes up to 32 items.
  • Send statement or statements, never both. Both keys together return 400 with {"error":{"code":"invalid_request","message":"body: provide statement or statements, not both"}}. The same message appears when you send neither.
  • yes-no is the one capability that does not enforce text or texts. If you send both, it uses text and ignores texts. If you send neither, it returns {"results":[]}.
  • The common mistake is a statement that names the verdict instead of the case. Write “The customer expresses urgency.”, not “urgent”. Writing good statements and labels has more bad examples.
  • Texts over 2,000 characters are split into chunks. A statement’s score is its maximum over the chunks, so a claim that holds in the last paragraph still scores high. See Long text and chunking.
  • Write statements and hints in English, even when the text is not English. See Languages.

Next