Eevo console
Contents
How-to guides

Writing requests for Eevo

This guide covers how to write requests for Eevo's two APIs. Choose the tab for the API you are calling.

The SystemOne-compatible API follows the SystemOne endpoint format, introduced by Typesafe for asking a model typed questions about a state; SystemOne decision has the full reference.

A SystemOne request consists of a state, which holds the content the questions are about as plain text or a JSON object, and the questions themselves.

Choice questions

A choice question's probabilities add up to 1 across the choices you send, so a case that fits none of them goes to whichever choice is closest. If such cases can occur, add a choice for them, as the model routing example does with general.

There is no need to ask a choice question again with its options reordered: Eevo already averages over their order, as described under Option order.

Score questions

List the levels of a score question from lowest to highest, since a level's position in the list is its score.

Yes/no questions

A yes/no question can be phrased as a statement or as a question; the examples in these docs use statements, such as "The customer is attempting fraud." Keep each to a single proposition. "The task needs tools or a long context" should be split into two questions, since one probability cannot say which half is true.

When the state doesn't contain the answer

Eevo always gives an answer, even when the state doesn't contain the information the question needs. If a support message never says which order it is about, a question about the order still gets one of your orders as its answer.

When the information may be missing, as in messages people write themselves, give Eevo a way to say it can't tell:

  • Choice question: add a choice like unknown.
  • Yes/no or score question: also ask whether the state mentions the subject at all. A low probability for "The item arrived damaged." can mean the item was fine or that the message doesn't mention its condition. mentions_condition below tells the two apart: act on damaged only when mentions_condition is likely true (see Setting thresholds below).
JSON
{
  "questions": {
    "order": {
      "type": "choice",
      "instructions": "Which order is the message about?",
      "criteria": {
        "A-1041": "The running shoes",
        "A-1187": "The rain jacket",
        "unknown": "The message does not say"
      }
    },
    "damaged": {
      "type": "noul",
      "instructions": "The item arrived damaged."
    },
    "mentions_condition": {
      "type": "noul",
      "instructions": "The message mentions the condition the item arrived in."
    }
  }
}

When the state always contains the information, such as a record with required fields, leave these out.

When more than one choice can apply

A choice question picks exactly one answer. If several can be true at once, such as a post that breaks two rules, ask one yes/no question per option instead: "The post harasses someone." and "The post is spam." Each gets its own probability, so any number of them can be likely.

With two or three options, you can instead list the combinations as choices, such as spam, harassment, both and neither. The number of combinations doubles with each option, so with more than three, use one yes/no question per option.

Dates and calculations

It is better to do date and money calculations in your own code and send the result, because your code gets them exactly right. Eevo is good at judging text but less reliable at arithmetic, and it doesn't know today's date unless you send it. For example, send "days_since_purchase": 41 rather than the purchase date.

Several questions in one request

When you need several answers about the same input, ask for them in one request. The state is then sent and billed only once.

Setting thresholds

The probabilities let your code decide when to act on its own and when to hand a case to a person. Set that threshold separately for each question, based on a small labelled sample of your own cases. Probability, confidence and expected value explains what the numbers mean.