## Answers and responses

Read answers, confidence scores, token usage, and available models returned by the TypeSafe API.

---

# Response

## typesafe_sdk.SystemOneResponse

`pydantic-model`

Bases: `Response`

Answers grouped by question type with model and usage metadata.

See [System One](https://docs.typesafe.ai/concepts/system-one) for details.

***JSON schema:***

```json
{
  "$defs": {
    "ChoiceAnswer": {
      "description": "A selected label and its probabilities.\n\nSee the [choice primitive](https://docs.typesafe.ai/primitives/choice) for details.",
      "properties": {
        "type": {
          "const": "choice",
          "default": "choice",
          "title": "Type",
          "type": "string"
        },
        "choice": {
          "description": "The name of the choice with the highest probability among the question's criteria.",
          "examples": [
            "angry"
          ],
          "title": "Choice",
          "type": "string"
        },
        "confidence": {
          "description": "Confidence in the selected choice, from 0 to 1. Higher values indicate greater certainty; use lower values to flag uncertain selections for review.",
          "examples": [
            0.9
          ],
          "title": "Confidence",
          "type": "number"
        },
        "probabilities": {
          "additionalProperties": {
            "type": "number"
          },
          "description": "Probability of each choice in criteria, keyed by choice name, from 0 to 1. Shows how likely the alternatives are; values sum to approximately 1.",
          "examples": [
            {
              "angry": 0.8,
              "calm": 0.1,
              "excited": 0.1
            }
          ],
          "title": "Probabilities",
          "type": "object"
        }
      },
      "required": [
        "choice",
        "confidence",
        "probabilities"
      ],
      "title": "ChoiceAnswer",
      "type": "object"
    },
    ...
  },
  "description": "Answers grouped by question type with model and usage metadata.",
  "properties": {
    "model": {
      "title": "Model",
      "type": "string"
    },
    "usage": {
      "$ref": "#/$defs/Usage"
    },
    "answers": {
      "additionalProperties": {
        "discriminator": {
          "mapping": {
            "choice": "#/$defs/ChoiceAnswer",
            "noul": "#/$defs/NoulAnswer",
            "score": "#/$defs/ScoreAnswer"
          },
          "propertyName": "type"
        },
        "oneOf": [
          {
            "$ref": "#/$defs/NoulAnswer"
          },
          {
            "$ref": "#/$defs/ChoiceAnswer"
          },
          {
            "$ref": "#/$defs/ScoreAnswer"
          }
        ]
      },
      "title": "Answers",
      "type": "object"
    }
  },
  "required": [
    "model",
    "usage"
  ],
  "title": "SystemOneResponse",
  "type": "object"
}
```

---

## typesafe_sdk.Usage

`pydantic-model`

Token counts for a request, when reported by the API.

***JSON schema:***

```json
{
  "description": "Token counts for a request, when reported by the API.",
  "properties": {
    "input_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Input Tokens"
    },
    "output_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Output Tokens"
    }
  },
  "title": "Usage",
  "type": "object"
}
```

---

## typesafe_sdk.NoulAnswer

`pydantic-model`

Bases: `wire.NoulAnswer`

A yes/no answer.

See the [noul primitive](https://docs.typesafe.ai/primitives/noul) for details.

***JSON schema:***

```json
{
  "description": "A yes/no answer.\n\nSee the [noul primitive](https://docs.typesafe.ai/primitives/noul) for details.",
  "properties": {
    "type": {
      "const": "noul",
      "default": "noul",
      "title": "Type",
      "type": "string"
    },
    "noul": {
      "description": "Probability of a yes answer or a true statement, from 0 to 1. Values near 1 favor yes or true, values near 0 favor no or false, and values near 0.5 indicate uncertainty.",
      "examples": [
        0.98
      ],
      "title": "Noul",
      "type": "number"
    }
  },
  "required": [
    "noul"
  ],
  "title": "NoulAnswer",
  "type": "object"
}
```

---

## typesafe_sdk.ChoiceAnswer

`pydantic-model`

Bases: `wire.ChoiceAnswer`

A selected label and its probabilities.

See the [choice primitive](https://docs.typesafe.ai/primitives/choice) for details.

***JSON schema:***

```json
{
  "description": "A selected label and its probabilities.\n\nSee the [choice primitive](https://docs.typesafe.ai/primitives/choice) for details.",
  "properties": {
    "type": {
      "const": "choice",
      "default": "choice",
      "title": "Type",
      "type": "string"
    },
    "choice": {
      "description": "The name of the choice with the highest probability among the question's criteria.",
      "examples": [
        "angry"
      ],
      "title": "Choice",
      "type": "string"
    },
    "confidence": {
      "description": "Confidence in the selected choice, from 0 to 1. Higher values indicate greater certainty; use lower values to flag uncertain selections for review.",
      "examples": [
        0.9
      ],
      "title": "Confidence",
      "type": "number"
    },
    "probabilities": {
      "additionalProperties": {
        "type": "number"
      },
      "description": "Probability of each choice in criteria, keyed by choice name, from 0 to 1. Shows how likely the alternatives are; values sum to approximately 1.",
      "examples": [
        {
          "angry": 0.8,
          "calm": 0.1,
          "excited": 0.1
        }
      ],
      "title": "Probabilities",
      "type": "object"
    }
  },
  "required": [
    "choice",
    "confidence",
    "probabilities"
  ],
  "title": "ChoiceAnswer",
  "type": "object"
}
```

---

## typesafe_sdk.ScoreAnswer

`pydantic-model`

Bases: `wire.ScoreAnswer`

An expected score with its rubric and probabilities.

See the [score primitive](https://docs.typesafe.ai/primitives/score) for details.

***JSON schema:***

```json
{
  "description": "An expected score with its rubric and probabilities.\n\nSee the [score primitive](https://docs.typesafe.ai/primitives/score) for details.",
  "properties": {
    "type": {
      "const": "score",
      "default": "score",
      "title": "Type",
      "type": "string"
    },
    "score": {
      "description": "Expected score: the probability-weighted average of the rubric levels. May fall between integer levels.",
      "examples": [
        1.7
      ],
      "title": "Score",
      "type": "number"
    },
    "confidence": {
      "description": "Confidence in the score, from 0 to 1. Higher values indicate greater certainty; use lower values to flag uncertain ratings for review.",
      "examples": [
        0.9
      ],
      "title": "Confidence",
      "type": "number"
    },
    "legend": {
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "additionalProperties": true,
            "type": "object"
          },
          {
            "items": {},
            "type": "array"
          }
        ]
      },
      "title": "Legend",
      "type": "object"
    },
    "probabilities": {
      "additionalProperties": {
        "type": "number"
      },
      "title": "Probabilities",
      "type": "object"
    }
  },
  "required": [
    "score",
    "confidence",
    "legend",
    "probabilities"
  ],
  "title": "ScoreAnswer",
  "type": "object"
}
```
