Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Laya decisions

POST /v1/decide is a manual-testing extension for Laya decision checkpoints. It evaluates one typed question per property of a flat JSON schema and returns decided values plus option probabilities. It is separate from chat completions and the managed model catalog.

curl http://127.0.0.1:8080/v1/decide \
  -H "Authorization: Bearer $MIRMIR_HTTP_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "checkpoint": "/models/laya-multilingual",
    "backend": "cpu",
    "state": {"text": "We were billed twice for March."},
    "schema": {
      "type": "object",
      "properties": {
        "refund": {"type": "boolean"},
        "urgency": {"type": "integer", "minimum": 1, "maximum": 3}
      }
    }
  }'

backend is cpu by default, or metal on macOS. The Rust API also supports CUDA; the HTTP endpoint does not expose it. state accepts either text or a conversation array of turns. Text truncation keeps the beginning; conversation truncation keeps the newest turns.

The response contains values and a fields array with each field’s name, options, probabilities, confidence, concentration, and, for scales, expected_level. Supported questions include booleans, finite enums, and bounded integer scales of at most ten levels. Unsupported schemas (such as free strings or multipleOf), unknown backends, and unreadable paths return 400.

The endpoint uses the server’s bearer authentication and accepts a local checkpoint path. One checkpoint/backend stays resident at a time, on a dedicated worker. Four requests may wait behind the running job; excess work returns 503. Abandoned queued jobs are skipped. A running decision finishes even when its HTTP handler disappears, and its unused result is dropped.

For embedded applications, see the decision API.