# Primitives (Questions)

The three TypeSafe question types (Choice, Score, Noul), the typed answers they return, how to choose between them, and how to ask several at once.

## TypeSafe Example Code

```javascript
export function TypesafeExample({example, display, title}) {
  const keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
  function compressToEncodedURIComponent(input) {
    if (input == null) return "";
    return _compress(input, 6, function (a) {
      return keyStrUriSafe.charAt(a);
    });
  }
  // ...additional code...
}
```

TypeSafe's primitives are the small, typed building blocks you compose in code. They come in pairs: a question defines one judgment for a [System One model](/concepts/system-one) to make about a [state](/concepts/state), and its answer is the typed value that comes back. You compose the answers in your code to make decisions. There are three question types, each returning a different shape of answer.

| Type                         | What it answers         | Returns                                          |
| ---------------------------- | ----------------------- | ------------------------------------------------ |
| [Choice](/primitives/choice) | Which of these options? | `choice`, `probabilities`, `confidence`          |
| [Score](/primitives/score)   | Which level?            | `score`, `legend`, `probabilities`, `confidence` |
| [Noul](/primitives/noul)     | Is this true?           | `noul` (0 to 1)                                  |

## Ask for One Snap Judgment Per Question

System One models are built for fast, focused judgments. Ask for a judgment a knowledgeable person makes in a second given the right context.

## Define a Question

Every question has an ID, a `type`, and `instructions`. Choice and Score questions also take `criteria`, which define the options for a Choice question or the levels for a Score. Noul questions accept `criteria` as an optional clarification of what yes and no mean.

- **ID**: The key you pick, such as `refund_requested`.
- **Type**: One of `choice`, `score`, or `noul`.
- **Instructions**: The question you are asking about the state.
- **Criteria**: The possible answers for your question types as outlined above.

Example question:

```python
ticket_message = "I was charged twice for order A-104. Please refund the duplicate."
questions = {
    "refund_requested": Noul(
        instructions="Does the customer request a refund?",
    ),
}
```

## Choose a Question Type

- **Choice** fits when the answer is one of a known set of options.
- **Score** fits when the answer falls on a spectrum.
- **Noul** fits for a clean yes/no question.

## What Comes Back

Answers are typed values that your code can utilize in further logic:

| Type   | Answer fields                                    | How to read it                                                                                                                                                       |
| ------ | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Choice | `choice`, `probabilities`, `confidence`          | The selected option, distribution across every option, and summarized confidence.                                                                                   |
| Score  | `score`, `legend`, `probabilities`, `confidence` | The position along your levels and the distribution across levels.                                                                                                  |
| Noul   | `noul`                                           | The probability that the answer is yes.                                                                                                                           |

## Next Steps

Explore further patterns using these question types to enhance your application.
