Eevo console
Contents
Reference
POST

SystemOne decision

Answer one or more questions based on the given state (context). This endpoint is compatible with the SystemOne endpoint format introduced by Typesafe.

Quick example

Below is a quick example of making a SystemOne request to Eevo via curl:

cURL
curl https://eevo.io/api/v1/systemone \
  -H "Authorization: Bearer $EEVO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "eevo-1",
  "state": "Support ticket: a customer was charged twice for an €80 order because of an error in our billing system. Agents may refund up to €50 without approval.",
  "questions": {
    "action": {
      "type": "choice",
      "instructions": "What should the support agent do?",
      "criteria": {
        "refuse": "Refuse, and cite the €50 limit",
        "partial": "Refund €50 and ask the customer to contact billing for the rest",
        "refund": "Refund the €80 duplicate charge and record the exception"
      }
    },
    "urgency": {
      "type": "score",
      "instructions": "How urgent is the ticket?",
      "criteria": [
        "Not urgent",
        "Somewhat urgent",
        "Urgent",
        "Critical"
      ]
    },
    "fraud": {
      "type": "noul",
      "instructions": "The customer is attempting fraud."
    }
  }
}'

The response:

JSON
{
  "model": "eevo-1.2",
  "answers": {
    "action": {
      "type": "choice",
      "choice": "refund",
      "confidence": 0.71,
      "probabilities": {
        "refuse": 0.07,
        "partial": 0.22,
        "refund": 0.71
      }
    },
    "urgency": {
      "type": "score",
      "score": 2,
      "confidence": 0.58,
      "legend": {
        "0": "Not urgent",
        "1": "Somewhat urgent",
        "2": "Urgent",
        "3": "Critical"
      },
      "probabilities": {
        "0": 0.03,
        "1": 0.31,
        "2": 0.58,
        "3": 0.08
      }
    },
    "fraud": {
      "type": "noul",
      "noul": 0.04
    }
  },
  "usage": {
    "input_tokens": 412,
    "output_tokens": 0
  },
  "meta": {
    "orderings": 3
  }
}

The response includes a meta field only when a choice question was asked in more than one order of its options. Its orderings value is the highest number of orderings used for any question in the request; see Option order below.

Supported question types

Requests can have multiple questions, and it is possible to mix questions of different types. Questions can be any of the following types:

TypeDescriptionOutput
choiceA multiple-choice questionProbability for each choice
scoreA question whose answer is a number on a scaleEstimated score with its confidence
noulA yes-or-no question, or a statement that is true or falseProbability of yes, or of the statement being true
box (preview)Where one named object is in an imageThe probability that it is there, and its bounding box as fractions of the image’s height and width, with a confidence

A noul question can also define when its statement counts as true and when as false, in criteria under true and false. Either may be left out; any other key is refused. The answer is still the probability that the statement is true:

JSON
{
  "questions": {
    "refundable": {
      "type": "noul",
      "instructions": "The order qualifies for a refund.",
      "criteria": {
        "true": "The item arrived damaged or not as described, and the claim was made within 30 days of delivery",
        "false": "The customer changed their mind, or the claim was made more than 30 days after delivery"
      }
    }
  }
}

Several choices that apply (preview). A choice question with "multiple": true returns every choice that applies, any number of them, rather than one. Eevo asks each choice as its own yes/no question about the same state, so probabilities gives each choice's own probability, and they need not sum to 1. choices lists those at 0.5 or above, in the question's order; for another cut-off, read probabilities. The request has the same format as Liquid's. Each choice is asked, and billed, as one yes/no question.

JSON
{
  "questions": {
    "teams": {
      "type": "choice",
      "multiple": true,
      "instructions": "Which teams must act on this incident?",
      "criteria": {
        "billing": "Billing: wrong charges, invoices and refunds",
        "support": "Support: customers who need an answer or an apology",
        "security": "Security: leaked data, passwords or access"
      }
    }
  }
}
JSON
{
  "answers": {
    "teams": {
      "type": "choice",
      "multiple": true,
      "choices": [
        "billing",
        "security"
      ],
      "probabilities": {
        "billing": 0.94,
        "support": 0.12,
        "security": 0.88
      }
    }
  }
}

Writing requests for Eevo covers how to write each type of question.

Option order

Eevo averages over the order of a choice question's options, so you do not need to ask the same question in different orders yourself. A choice question with n options is asked in min(n, 3) rotations of its options in parallel, and choice and confidence come from the averaged probabilities. Although a question may be asked several times, your input is billed only once.

Score and yes/no questions are asked once, in the order sent. So is a choice question whose text refers to an option by its key, such as "Option A is the status quo", and so is every question in a request with images.

Images and box questions (preview)

Preview: images and box questions. Send images in assets, keyed by a reference you write as plain text where the image belongs: in a string value of state, or in a question's instructions or criteria (a yes/no question's true and false included, with their example images). Every image must be referenced. A reference that appears only as an object key, such as a field name in state or a choice label, does not count: in the Typesafe format, keys stay text. A box question names one target and returns its bounding box as fractions of the image's height (top, bottom, from the top) and width (left, right, from the left), and found, the probability that the target is in the image. Below 0.5, box is null and there is no confidence. Eevo reads found from a yes/no question it asks with the box, billed as one. For a target that is always there, such as "the most damaged area", found says little; ask your own yes/no question about what you are looking for. Only Eevo versions that accept images take them; the others answer 400. The image tokens are billed as input tokens, about one per 32×32 pixels.

JSON
{
  "model": "eevo-1",
  "state": "A photo of the returned parcel: photo_1",
  "questions": {
    "damaged": {
      "type": "noul",
      "instructions": "The parcel in the image is damaged."
    },
    "label": {
      "type": "box",
      "instructions": "the shipping label"
    }
  },
  "assets": {
    "photo_1": {
      "type": "image",
      "format": "jpg",
      "data_base64": "/9j/4AAQSkZJRgABAQ…"
    }
  }
}
JSON
{
  "model": "eevo-1",
  "answers": {
    "damaged": {
      "type": "noul",
      "noul": 0.87
    },
    "label": {
      "type": "box",
      "found": 0.97,
      "box": {
        "top": 0.18,
        "bottom": 0.41,
        "left": 0.52,
        "right": 0.86
      },
      "confidence": 0.79
    }
  },
  "usage": {
    "input_tokens": 1311,
    "output_tokens": 0
  }
}

A box whose target is most likely not in the image:

JSON
{
  "answers": {
    "customs_form": {
      "type": "box",
      "found": 0.03,
      "box": null
    }
  }
}

Naming an image in a question. In a question's instructions or criteria, a state field in backticks names the image held in that field: photo, or a path such as faces.happy or frames[2].frame. The field's value must be the image's reference, or a text with exactly one reference in it. A field that holds anything else stays as written. Writing the reference itself works too.

A box with several images. When a request has more than one image, each box question must name the one image it searches, by its state field in backticks or by its reference. A box that names none, or more than one, is refused with 400. Every image in assets counts, example images in a yes/no definition included, so one photo with example images still needs its box to name the photo. With one image there is nothing to name.

JSON
{
  "model": "eevo-1",
  "state": {
    "notes": "The parcel before and after transit.",
    "before": "photo_1",
    "after": "photo_2"
  },
  "questions": {
    "dent": {
      "type": "box",
      "instructions": "the largest dent in `after`"
    }
  },
  "assets": {
    "photo_1": {
      "type": "image",
      "format": "jpg",
      "data_base64": "/9j/4AAQSkZJRgABAQ…"
    },
    "photo_2": {
      "type": "image",
      "format": "jpg",
      "data_base64": "/9j/4AAQSkZJRgABAQ…"
    }
  }
}

Example images in a yes/no definition. Each side of a noul question's criteria can be a text, or a description with example images, each written as its reference: {"description": "…", "examples": ["<reference>", …]}. The example images count as references, so send them in assets like any other image.

JSON
{
  "questions": {
    "damaged": {
      "type": "noul",
      "instructions": "The parcel in `photo` is damaged.",
      "criteria": {
        "true": {
          "description": "Torn, crushed or wet",
          "examples": [
            "torn_example",
            "crushed_example"
          ]
        },
        "false": {
          "description": "Scuffed tape or dust only",
          "examples": [
            "scuffed_example"
          ]
        }
      }
    }
  }
}

To send the images as files rather than base64, post the request to this endpoint, with your API key, as multipart/form-data, the format of TypeSafe's System One API. The first part, named request, holds the JSON request, and each image is a part of its own with a unique name. An asset names its part as {"type": "image", "part": "<part name>"} instead of giving data_base64, and its format is then optional: Eevo reads it from the image. Every image part must be used by exactly one asset.

Shell
curl https://eevo.io/api/v1/systemone \
  -H "Authorization: Bearer $EEVO_API_KEY" \
  -F 'request={"model": "eevo-1", "state": "A photo of the returned parcel: photo_1", "questions": {"label": {"type": "box", "instructions": "the shipping label"}}, "assets": {"photo_1": {"type": "image", "part": "photo_1"}}};type=application/json' \
  -F 'photo_1=@parcel.jpg'

Request body

application/json
  • modelstringOptional

    The identifier of the Eevo model: eevo-1 (the default when left out), which always points at the latest Eevo-1 version.

  • statestring or mapRequired

    The content every question in this request is about: text, or any JSON object.

  • questionsmap of objectsRequired

    The questions to ask about the state, each under a name you choose. The response uses those names to identify the answers.

    • {key}object

      A question about the state, of one of the types below. One request can mix types.

      typestringRequired
      • instructionsstringOptional

        What the model should decide when it picks a choice.

      • criteriamap of stringsRequired

        The choices, each under a name you choose, with a description of when it applies. The answer names the choice it picked.

        • {key}string

          When this choice applies.

        Example
        {
          "refuse": "Refuse, and cite the €50 limit",
          "partial": "Refund €50 and ask the customer to contact billing for the rest",
          "refund": "Refund the €80 duplicate charge and record the exception"
        }
      • multiplebooleanOptional

        In preview: true to get every choice that applies, any number of them, rather than one. The answer gives each choice’s own probability and lists those at 0.5 or above in choices.

  • assetsmap of objectsOptional
    1 field
    • {key}object
      • typestringOptional
        Valueimage
      • formatstringRequired
        One ofpngjpgjpeg
      • data_base64stringRequired
  • metadataobjectOptional

    Optional. Where the request came from and for whom (a chat, an issue, a pull request), for the decision log in the Eevo console. Not sent to the model.

    5 fields
    • conversationobjectOptional
      3 fields
      • platformstringRequired
        One ofslackteamsgoogle_chatother
      • channelstringOptional
      • thread_urlstringOptional
    • issueobjectOptional
      4 fields
      • trackerstringRequired
        One oflinearjiragithubother
      • urlstringRequired
      • keystringOptional
      • titlestringOptional
    • pull_requestobjectOptional
      5 fields
      • platformstringRequired
        One ofgithubgitlabbitbucketazure_devopsother
      • urlstringRequired
      • repostringOptional
      • numberintegerOptional
      • titlestringOptional
    • on_behalf_ofobjectOptional
      2 fields
      • namestringOptional
      • emailstring <email>Optional
    • linksarray of objectsOptional
      2 fields
      • urlstringRequired
      • labelstringOptional
  • share_with_orgbooleanOptional

Response body

application/json
  • idstring

    Request id, as in the Eevo console decision log.

  • modelstring

    The Eevo model version that answered the questions, such as eevo-1.2 for the alias eevo-1.

  • answersmap of objects

    Answers keyed by the question names supplied in the request. Each answer’s type matches its question’s type.

    • {key}object

      An answer whose type matches its question’s.

      typestring
      • choicestring

        The name of the choice with the highest probability among the question’s criteria. Not on a multi-select answer.

      • confidencenumber

        Confidence in the selected choice, from 0 to 1: its probability. Higher values mean more certainty; a low value is worth flagging for review.

      • probabilitiesmap of numbers

        The probability of each choice, from 0 to 1, by its name: how likely the alternatives are. They sum to 1. On a multi-select answer, each choice’s own probability of applying, which need not sum to 1.

      • multipleboolean

        In preview: only on the answer to a question asked with "multiple": true.

        Valuetrue
      • choicesarray of strings

        Multi-select only: the names of the choices with a probability of 0.5 or above, in the question’s order. May be empty.

  • usageobject

    Input and output token counts for this request.

    • input_tokensinteger

      Number of billable input tokens used to evaluate the request.

    • output_tokensinteger

      Number of output tokens used to answer the questions. Output tokens are free.

  • metaobject

    Only when a choice question was asked in several orders of its options and the probabilities averaged: orderings is the most orderings any question of the request was asked in.

    • orderingsinteger

Error responses

An error answers with its status and a body with its type and a message. See Errors for the format and every type.

StatusTitleDescription
400Bad RequestThe request is invalid; the message says which field and why.
401UnauthorizedNo valid API key.
402Payment RequiredNo credit left for the request, or an EU request from an organization that has neither bought credit nor has credit.
403ForbiddenOnly the person who made the decision, or the API key it was made with, can change who sees it or publish it.
409ConflictThe model is not served yet, or the revised decision already has a newer revision.
410GoneNo such decision that you can see: none in your organization, or one not shared with you.
429Too Many RequestsRate limit or concurrent request limit reached; retry after Retry-After seconds.
502Bad GatewayThe model failed to answer, or the decision could not be completed. Nothing is billed.
503Service UnavailableThe model is starting after being idle (`model_warming`), or a request for the EU found no EU server available (`region_unavailable`); retry after Retry-After seconds. Nothing is billed.

How-to guides

Examples of tasks the SystemOne decision endpoint answers: