> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqwish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Core concepts

> The few ideas you need to use OneHot, and the words the rest of these docs use.

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**.

```json theme={null}
{
  "context": "Please refund the duplicate charge on order 4471.",
  "decisions": [
    {"id": "refund", "kind": "binary", "question": "Does the customer ask for money back?"},
    {"id": "team", "kind": "single", "question": "Which team should handle this?",
     "outcomes": ["billing", "orders", "technical"]}
  ]
}
```

* `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](https://docs.sqwish.ai/guides/writing-decisions.md)).

One request can ask up to 128 decisions about the same context, and you pay for the context
once.

## Three kinds of decision

| Kind | Use it to | Outcomes |
| - | - | - |
| `binary` | Answer a yes or no question | Always `yes` and `no`. You can describe what each one means |
| `single` | Pick one of several categories | 2 to 255 names, as a list, or as a map from each name to its description |
| `ordinal` | Rate something on an ordered scale | 2 to 255 levels in order, lowest first, with a `rubric` line describing each level |

A decision with no `kind` is `single`.

## Answers

Every decision gets its own answer, under its `id`:

```json theme={null}
"team": {
  "kind": "single",
  "probabilities": {"billing": 0.927, "orders": 0.054, "technical": 0.019},
  "top": "billing",
  "p_top": 0.927
}
```

* `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](https://docs.sqwish.ai/guides/interpreting-results.md)).

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](https://docs.sqwish.ai/guides/interpreting-results.md#turn-probabilities-into-actions)).

## Models

OneHot's models are called **kettei**. There are three base models, smallest to largest:

| Model | Reads images | Notes |
| - | - | - |
| `kettei-core` | No | The smallest and cheapest, and the default |
| `kettei-chub` | Yes | |
| `kettei-fat` | Yes | The largest. It can't be fine-tuned |

A larger model costs more per token ([pricing](https://docs.sqwish.ai/guides/pricing.md)). 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](https://docs.sqwish.ai/guides/models-and-fallback.md)).

## 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](https://docs.sqwish.ai/guides/improve.md)):

* 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](https://docs.sqwish.ai/guides/families.md)). 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](https://docs.sqwish.ai/guides/organisations.md)).

* An **API key** lets your code call OneHot. Create one in the
  [console](https://console.sqwish.ai) ([access and keys](https://docs.sqwish.ai/guides/accounts-and-usage.md#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](https://docs.sqwish.ai/guides/accounts-and-usage.md)).
* In a Team, **projects** keep separate pieces of work apart, such as staging and production
  ([projects](https://docs.sqwish.ai/guides/projects.md)).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.