SegmindSegmind / Docs

Decision Models

Ask a decision model typed questions — yes/no, choice, score or box — about text, JSON or media, and get probabilities back in one shape across every model.

A decision model answers typed questions about a state with probabilities, not prose. You describe what to judge, ask questions with a fixed answer type, and read numbers you can threshold, route on or log:

{
  "state": "Customer email: 'I was charged twice for my subscription this month, please refund one.'",
  "questions": {
    "is_bug":  { "type": "noul",   "instructions": "Is this a software bug report?" },
    "team":    { "type": "choice", "instructions": "Which team should handle this?",
                 "options": { "billing": "Payments and refunds", "support": null, "sales": null } },
    "urgency": { "type": "score",  "instructions": "How urgent is this?", "levels": ["low", "medium", "high"] }
  }
}

Every decision model takes the same request and returns the same answer shape, so one body can be sent to several models and the answers compared directly.

Question types

TypeAsksAnswer
noulA yes/no question. Optional criteria: { "true": "...", "false": "..." } says what each answer means.probability: the probability of yes, in [0, 1]
choicePick one of options: a list of keys, or a map of key to description (or null).choice, plus probabilities per option
scorePlace the state on an ordered scale. levels run lowest first; each is a label or { "label", "description" }.score: the expected level index (0 = the lowest level), plus probabilities and labels per level
boxLocate something in the request's image.box: top, bottom, left, right, each in [0, 1]

Question and option keys are 1–64 characters of A-Z a-z 0-9 _ -. Answers come back under the same keys.

The request

FieldTypeNotes
statestring, or a JSON object or arrayRequired. What the model judges.
questionsobjectRequired. Question key to question.
imagesURL, data URI or base64, or a listOptional; up to 8.
audio, video, filessameOptional; on the models that take them, up to 4 each.
optionsobjectOptional features, below.

Options

Options are grouped by what they do. A model that cannot honour a module ignores it and says so in warnings, so one body still runs everywhere; an unknown module, field or value is a 400 on every model alike.

ModuleFieldsWhat it does
cachingkeyReuse a prompt cache across calls that share this key.
sessionidKeep a run of related calls on the same upstream session.
routingprefer (latency, price or throughput), zero_data_retention (bool)How the call is routed upstream.

Cache keys and session ids are scoped to your account: two accounts using the same key never share a cache or a session.

Model support

ModelQuestion typesMediaChoice optionsScore levelsOptions
jev-1.14noul, choice, score, boximages2 or more1 or moresession, routing
microsoft-decision-1.1noul, choice, scoreimages2 or more1 or moresession, routing
gemini-decision-1noul, choice, scoreimages, audio, video, files2 to 2551 or moresession, routing
gpt-6-luna-decisionsnoul, choice, scoreimages2 or more2 to 10caching

gpt-6-luna-decisions takes at most 400 questions per request. A request a model can't take — a question type it lacks, too many options or levels, a media kind it doesn't accept — is refused with a 400 that names the field, before the model is called.

The response

{
  "model": "jev-1.14",
  "answers": {
    "is_bug":  { "type": "noul", "status": "ok", "probability": 0.24, "confidence": null },
    "team":    { "type": "choice", "status": "ok", "choice": "billing",
                 "probabilities": { "billing": 1.0, "sales": 0.0, "support": 0.0 }, "confidence": 1.0 },
    "urgency": { "type": "score", "status": "ok", "score": 1.22,
                 "probabilities": [0.01, 0.76, 0.23], "labels": ["low", "medium", "high"], "confidence": 0.64 }
  },
  "raw": { "...": "the model's own answer" },
  "usage": { "input_tokens": 400, "cached_tokens": 0, "cache_write_tokens": 0 },
  "cost": 0.000021,
  "latency_ms": 802,
  "warnings": []
}
FieldMeaning
answersQuestion key to its normalised answer.
rawThe model's own answer, for anything the normalised shape leaves out.
usageInput tokens, and how many were read from or written to a cache.
costWhat this call was charged, in USD — the same figure as the X-Cost header.
latency_msThe model's own time, measured inside the gateway, without your network.
warningsFields or options this model ignored.

Answer statuses

statusMeaning
okThe model answered; the answer's numbers are present.
refusedThe model declined to answer this question.
errorNo usable answer, with error saying why.

A refused or error answer carries no number — never a 0, never a default. Check status before you read probability, choice, score or box, or a declined question will be read as a confident "no".

A call where no question got an ok or refused answer is not charged.

On v2

An async result carries the whole response above as a string in output:

result = requests.get(poll_url, headers=headers).json()
decision = json.loads(result["output"])
print(decision["answers"]["is_bug"]["probability"])

The SDKs decode it for you. A decision model typically answers in about a second, so a single blocking /v1 call is usually the better fit.

Errors

These come from the gateway before the model is called: a 400 on /v1, a FAILED request carrying the same message on /v2. Each names the field.

Message (example)Cause
state: is required: non-empty text or a JSON object/arraystate missing or empty
questions: is required: a map of question key to questionquestions missing, empty or not an object
questions.logo.type: 'box' is not supported by microsoft-decision-1.1 (supported: choice, noul, score)A question type the model lacks
questions.team.options: option keys must be uniqueDuplicate option keys
questions.urgency.levels: gpt-6-luna-decisions takes 2 to 10 levels; got 1Outside the model's level range
video: microsoft-decision-1.1 does not accept videoA media kind the model doesn't take
images: jev-1.14 takes at most 8 images entriesToo many media entries

Examples

curl -X POST https://api.segmind.com/v1/jev-1.14 \
  -H "x-api-key: $SEGMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "Customer email: I was charged twice this month, please refund one.",
    "questions": {
      "is_bug": { "type": "noul", "instructions": "Is this a software bug report?" },
      "team": { "type": "choice", "instructions": "Which team should handle this?", "options": ["billing", "support", "sales"] }
    }
  }'

With the Python SDK:

import segmind
from segmind.decisions import choice, noul

decision = segmind.decide_sync(
    "jev-1.14",
    state="Customer email: I was charged twice this month, please refund one.",
    questions={
        "is_bug": noul("Is this a software bug report?"),
        "team": choice("Which team should handle this?", ["billing", "support", "sales"]),
    },
)
print(decision.probability("is_bug"), decision.choice("team"), decision.cost)

With the JavaScript SDK:

import { decideSync } from 'segmind';

const decision = await decideSync('jev-1.14', {
  state: 'Customer email: I was charged twice this month, please refund one.',
  questions: {
    is_bug: { type: 'noul', instructions: 'Is this a software bug report?' },
    team: { type: 'choice', instructions: 'Which team should handle this?', options: ['billing', 'support', 'sales'] },
  },
});
console.log(decision.probability('is_bug'), decision.choice('team'), decision.cost);

The SDK readers return None / undefined for a refused or errored answer.

Compare two models

Send the same body to each slug and compare answers, cost and latency:

body = dict(
    state="Customer email: I was charged twice this month, please refund one.",
    questions={"is_bug": noul("Is this a software bug report?")},
)
for slug in ("jev-1.14", "microsoft-decision-1.1"):
    d = segmind.decide_sync(slug, **body)
    print(slug, d.probability("is_bug"), d.cost, d.latency_ms)

Each decision model's page has a playground that does this side by side.

Notes

  • Billing is per call, for the tokens the call uses; cost on the response is the exact charge.
  • No streaming. A decision arrives whole.
  • A field a question type does not take, or an unknown top-level field, is ignored and listed in warnings.

On this page