DrexDocs

Drex API

Send state and typed questions. Get a calibrated probability for every answer in one call.

Drex is a decision model. You send state (text or JSON) and a set of named, typed questions about that state. Drex answers every question in one HTTP call and returns a probability distribution for each answer, so you can act on the answer and on how sure the model is.

The API is one endpoint, POST /v1/systemone at https://console.nace.ai, authenticated with a Bearer key. The model is drex-v1.5.

One request, three answers

This request asks three questions about one support ticket. The response is a real capture. Numbers vary slightly per call.

Request
{
  "model": "drex-v1.0",
  "state": "I was charged twice for my March invoice. Please refund one of the charges.",
  "questions": {
    "category": {
      "type": "choice",
      "instructions": "What is this support ticket about?",
      "criteria": {
        "billing": "Payments, invoices, refunds, or charges",
        "technical": "Bugs, errors, or outages",
        "account": "Login, profile, or permissions",
        "other": null
      }
    },
    "sentiment": {
      "type": "score",
      "instructions": "How upset is the customer?",
      "criteria": ["Calm", "Mildly annoyed", "Frustrated", "Angry"]
    },
    "wants_refund": {
      "type": "noul",
      "instructions": "Is the customer asking for a refund?"
    }
  }
}
Response
{
  "model": "drex-v1.0",
  "answers": {
    "category": {
      "type": "choice",
      "choice": "billing",
      "confidence": 0.986,
      "probabilities": {
        "billing": 0.9895,
        "technical": 0.005,
        "account": 0.0006,
        "other": 0.0049
      }
    },
    "sentiment": {
      "type": "score",
      "score": 1.5306,
      "legend": ["Calm", "Mildly annoyed", "Frustrated", "Angry"],
      "probabilities": { "0": 0.1572, "1": 0.3516, "2": 0.2946, "3": 0.1966 },
      "confidence": 0.7183
    },
    "wants_refund": {
      "type": "noul",
      "noul": 0.9868
    }
  },
  "usage": { "input_tokens": 106, "output_tokens": 212 },
  "evaluation_time_ms": 142.6,
  "request_id": "req_3f9c2b7e1a4d4c0e9b8a7f6e5d4c3b2a"
}

Each answer carries its type, so you can read answers.wants_refund.noul without checking what kind of question you asked. Billing counts input tokens only. See Pricing.

Three question types

  • noul asks a yes or no question. The answer is noul, the probability of yes, from 0 to 1.
  • choice picks one label from a set you define. The answer is the chosen label, a probability per label, and a confidence.
  • score places the state on an ordered scale you define. The answer is an expected score, a probability per level, the legend, and a confidence.

Questions covers each type in detail, and Reading answers covers what to do with the numbers.

Coming from TypeSafe

Drex is wire-compatible with TypeSafe's Jev. The TypeSafe SDK works against Drex after you change three environment variables. A few requests that TypeSafe accepted return a 422 from Drex on purpose. Migrate from TypeSafe lists them.

Where to go next

On this page