Skip to main content
OneHot answers questions about a piece of text. Instead of writing an answer, it gives a probability to each answer you allow. This page explains the parts of a request and of its answer. Every other page uses these words in the same way.

Decisions

You send a context, the text you want to ask about, and one or more decisions. A decision is one question, with the answers you allow. Those answers are its outcomes.
  • id is your name for the decision. The answer uses it as a key.
  • kind says what sort of question it is (see below).
  • question is plain text. You can also send JSON, as you can for the context.
  • outcomes lists the answers you allow. You can describe each one, which helps the model draw the line between them (write a decision).
One request can ask up to 128 decisions about the same context, and you pay for the context once.

Three kinds of decision

A decision with no kind is single.

Answers

Every decision gets its own answer, under its id:
  • probabilities gives every outcome you allowed a probability. They add up to 1.
  • top is the likeliest outcome, and p_top its probability.
  • An ordinal answer also has expected_level: the average level, counting the first level as 0.
A probability says how strongly the model favours an outcome over the others you listed. It is not a promise that the outcome is right. Check the model on examples whose answers you know before you act on its answers automatically (read results). The response also says which model answered, what the call cost (charge) and how many input tokens it was billed for (usage).

Policies

A policy turns probabilities into an action, so your code doesn’t have to:
  • abstain_below: when p_top is below this number, the action is abstain, and you can send the case to a person.
  • action_costs: what each of your actions costs for each outcome. OneHot picks the action with the lowest expected cost.
The answer then has a policy block with the action to take (read results).

Models

OneHot’s models are called kettei. There are three base models, smallest to largest: A larger model costs more per token (pricing). If the model you ask for can’t answer right now, another one answers instead unless you say not to. This is called fallback, and the answer tells you when it happens (models and fallback).

Your own models

When the base models aren’t accurate enough for a decision, you can improve it with your own examples (improve a decision):
  • A dataset holds example contexts with the answers you expect.
  • Labelling helps you get those answers when you have real inputs but no answers yet.
  • Fine-tuning trains a model of your own on your examples.
A fine-tuned model belongs to a family, a name you choose such as support-router. Calling the family gets you its current model. Each model in it also has a number, such as support-router@3, which you can call to get exactly that model (families). Only your organisation can call your models.

Your organisation

Everything you make and pay for belongs to an organisation. You start with your own, called Personal. To work with other people, create a Team organisation and invite them (organisations).
  • An API key lets your code call OneHot. Create one in the console (access and keys).
  • You pay from credit you buy in advance. The more you have bought, the higher your tier, and the higher your limits (usage and limits).
  • In a Team, projects keep separate pieces of work apart, such as staging and production (projects).