Documentation

Jev System One API

TypeLLM answers Jev's System One API at POST /v1/systemone. Code written with the typesafe-sdk runs on TypeLLM with two changes: the base URL and your TypeLLM API key.

Environment
export TYPESAFE_BASE_URL=https://api.typellm.ai
export TYPESAFE_API_KEY=$TYPELLM_API_KEY
Python
from typesafe_sdk import Choice, Noul, Score, TypeSafeClient

client = TypeSafeClient(timeout=60)

response = client.system_one(
    "Where is my refund?! This is the third time I've asked.",
    {
        "tone": Choice(
            instructions="What is the tone of this message?",
            criteria={
                "angry": "An upset or hostile message",
                "calm": "A neutral or polite message",
                "excited": "An enthusiastic or eager message",
            },
        ),
        "urgency": Score(
            instructions="How urgent is this message?",
            criteria=["Can wait", "Needs attention this week", "Needs attention today"],
        ),
        "spam": Noul(
            instructions="Is this message spam?",
            criteria={"true": "Unsolicited advertising", "false": "A legitimate conversation"},
        ),
    },
)
print(response.choices["tone"].choice, response.scores["urgency"].score, response.nouls["spam"].noul)
Example return
{
  "model": "jev-latest",
  "answers": {
    "tone": {"type": "choice", "choice": "angry", "confidence": 1.0,
             "probabilities": {"angry": 0.9999, "calm": 0.0, "excited": 0.0}},
    "urgency": {"type": "score", "score": 1.95, "confidence": 0.92,
                "legend": {"0": "Can wait", "1": "Needs attention this week", "2": "Needs attention today"},
                "probabilities": {"0": 0.01, "1": 0.03, "2": 0.96}},
    "spam": {"type": "noul", "noul": 0.0007}
  },
  "usage": {"input_tokens": 238, "output_tokens": 0}
}

Questions

  • noul returns the probability of a yes. Its criteria describe what counts as true and false.
  • choice returns the chosen name, the probability of each choice, and a confidence. Each criterion describes when its choice applies.
  • score returns the probability-weighted average of the levels, each level's probability, a legend and a confidence. A score needs at least two criteria.
  • Questions in one request are answered together, from the same state. See Confidence for how confidence is worked out.

Input

  • state, instructions and criteria may be text, objects or arrays. Objects and arrays reach the model as JSON.
  • jev-latest, any other Jev model name, or no model runs typellm-latest.
  • Choices and nouls average their probabilities over option orders, which takes a little longer: give the client a timeout above its default of 10 seconds.

Billing

A request is billed as a /v1/generate call: its input tokens, counted once, at TypeLLM's prices. usage.output_tokens is 0.

To ask for other types, such as numbers, text, objects and arrays, or to use thinking and dependencies, use /v1/generate.