Eevo console
Contents
Tutorials

Calling Eevo from code

1. Get an API key

Sign in to the Eevo console and create a key on API keys. New accounts get $1.00 of free credit, enough for about 24 million SystemOne input tokens, and no card is needed. Store the key securely. For simplicity, in this example it is stored in an environment variable:

Shell
export EEVO_API_KEY=eevo_sk_…

2. Call the API

The snippet below shows an example of calling Eevo via the SystemOne-compatible API. The payload has two parts, state and questions. The purpose of the state part is to provide overall context, while the questions part is for specifying the questions to be asked, along with a range of options for each question.

For details on payload format, see SystemOne decision in the API reference.

import os

import requests

response = requests.post(
    "https://eevo.io/api/v1/systemone",
    headers={"Authorization": f"Bearer {os.environ['EEVO_API_KEY']}"},
    json={
        "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.",
            },
        },
    },
)
response.raise_for_status()
print(response.json())

3. Handle the response

As a response, the Eevo SystemOne-compatible API provides the chosen answer for each question. This also includes probabilities for each option, which allows you to take uncertainty into account when making decisions based on 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
  }
}

Writing requests for Eevo covers how to phrase questions and set thresholds on the probabilities, and Errors says which errors to retry.

4. Before you go live

Before going to production, review your organization's settings on Data controls in the console: where requests run (the global or the EU region), how long requests are kept for each key (30 days by default), and whether stored requests can be used to improve Eevo (on by default). Data controls describes each setting.

Decision-models like Eevo can be useful for a wide variety of tasks. For inspiration, see some of the tutorials below: