EUrouter

Decisions

Classify text with a decision model and get typed answers with probabilities.

OpenAPI JSON

A decision model answers questions you define about content you send, instead of generating text. Every answer comes back with the probability of each option, so your code can act on confident answers and send borderline cases to a person.

Find a decision model

Decision models are left out of the default model list. Ask for them by output modality:

curl "https://api.eurouter.info/api/v1/models?output_modalities=decisions"

Use the id of a listed model as model in your request.

Classify an issue

This request asks three choice questions about one issue: its priority, its complexity and its type.

curl https://api.eurouter.info/api/v1/systemone \
  -H "Authorization: Bearer $EUROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "metis",
    "state": {
      "title": "Checkout fails with a 500 when the cart has more than 50 items",
      "description": "Since the release this morning, customers with large carts get an error page at checkout. Smaller carts still work."
    },
    "questions": {
      "priority": {
        "type": "choice",
        "instructions": "How urgent is this issue?",
        "criteria": {
          "urgent": "Production is down, or money or customer data is at risk",
          "high": "Important and should be fixed this week",
          "medium": "Should be fixed, but can wait for planning",
          "low": "Nice to have"
        }
      },
      "complexity": {
        "type": "choice",
        "instructions": "How hard is the fix likely to be?",
        "criteria": {
          "low": "A small, local change with a clear fix",
          "medium": "Several files or design choices, with a known approach",
          "high": "Crosses systems or still has open questions"
        }
      },
      "type": {
        "type": "choice",
        "instructions": "What kind of work is this?",
        "criteria": {
          "bug": "Behavior that does not match what is intended",
          "feature": "New functionality or an improvement",
          "chore": "Maintenance or internal housekeeping"
        }
      }
    }
  }'

Each answer comes back under the key you gave its question. The values below show the shape; your probabilities and token counts will differ.

{
  "model": "metis",
  "answers": {
    "priority": {
      "type": "choice",
      "choice": "urgent",
      "probabilities": { "urgent": 0.81, "high": 0.16, "medium": 0.02, "low": 0.01 },
      "confidence": 0.74
    },
    "complexity": {
      "type": "choice",
      "choice": "medium",
      "probabilities": { "low": 0.22, "medium": 0.63, "high": 0.15 },
      "confidence": 0.41
    },
    "type": {
      "type": "choice",
      "choice": "bug",
      "probabilities": { "bug": 0.97, "feature": 0.02, "chore": 0.01 },
      "confidence": 0.93
    }
  },
  "usage": {
    "input_tokens": 230,
    "output_tokens": 0,
    "cost": 0.0000276,
    "cost_currency": "EUR",
    "cost_eur": 0.0000276,
    "is_byok": false
  },
  "id": "gen-dec-1792571234-3f9c2a7d1e8b4c6a5f0d",
  "provider": "greenpt"
}

Question types

TypecriteriaAnswer
noulOptional true and false descriptionsnoul: the probability that the answer is yes, from 0 to 1
choiceOption name to description, 2 to 255 optionschoice, plus probabilities per option and confidence
scoreOrdered level descriptions, lowest firstscore, where 0 is the first level, plus legend and probabilities

instructions, state and every description can be a string or a JSON object or array. All questions are answered independently against the same state.

Cost

Decision models bill input tokens. usage.cost_eur is the amount taken from your balance. To look a request up later, pass its x-request-id response header to GET /generation.

See the Decisions API reference for every field.

Was this page helpful?

Still stuck? Contact support

On this page