{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/orq/json-schema/orq-classify-answer-schema.json",
  "title": "ClassifyAnswer",
  "description": "One answer to a classification question. The type selects the answer fields. A refusal contains only type.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/orq-classify-api-openapi.yml#/components/schemas/ClassifyAnswer",
  "oneOf": [
    {
      "$ref": "#/$defs/ClassifyNoulAnswer"
    },
    {
      "$ref": "#/$defs/ClassifyChoiceAnswer"
    },
    {
      "$ref": "#/$defs/ClassifyScoreAnswer"
    },
    {
      "$ref": "#/$defs/ClassifyBoxAnswer"
    },
    {
      "$ref": "#/$defs/ClassifyRefusalAnswer"
    }
  ],
  "$defs": {
    "ClassifyBox": {
      "additionalProperties": false,
      "properties": {
        "bottom": {
          "description": "Distance of the bottom edge from the top of the image, as a fraction of the image height.",
          "format": "double",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "left": {
          "description": "Distance of the left edge from the left of the image, as a fraction of the image width.",
          "format": "double",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "right": {
          "description": "Distance of the right edge from the left of the image, as a fraction of the image width.",
          "format": "double",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "top": {
          "description": "Distance of the top edge from the top of the image, as a fraction of the image height.",
          "format": "double",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        }
      },
      "required": [
        "top",
        "bottom",
        "left",
        "right"
      ],
      "type": "object"
    },
    "ClassifyBoxAnswer": {
      "additionalProperties": false,
      "properties": {
        "box": {
          "$ref": "#/$defs/ClassifyBox",
          "description": "The bounding box of the target. Present for box answers."
        },
        "confidence": {
          "description": "How sure the model is of the answer it selected: on emulated chat models the largest value in probabilities, so it adds nothing the distribution does not; native providers return their own confidence value, which can sit below the largest probability. Present for choice, score and box answers.",
          "format": "double",
          "type": "number"
        },
        "type": {
          "enum": [
            "box"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "box"
      ],
      "title": "ClassifyBoxAnswer",
      "type": "object"
    },
    "ClassifyChoiceAnswer": {
      "additionalProperties": false,
      "properties": {
        "choice": {
          "description": "The selected option. Present for choice answers.",
          "type": "string"
        },
        "confidence": {
          "description": "How sure the model is of the answer it selected: on emulated chat models the largest value in probabilities, so it adds nothing the distribution does not; native providers return their own confidence value, which can sit below the largest probability. Present for choice, score and box answers.",
          "format": "double",
          "type": "number"
        },
        "probabilities": {
          "additionalProperties": {
            "format": "double",
            "type": "number"
          },
          "description": "Probability distribution over the options or levels. Present for choice and score answers.",
          "type": "object"
        },
        "type": {
          "enum": [
            "choice"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "choice"
      ],
      "title": "ClassifyChoiceAnswer",
      "type": "object"
    },
    "ClassifyNoulAnswer": {
      "additionalProperties": false,
      "properties": {
        "noul": {
          "description": "Probability between 0 and 1 that the statement holds. Present for noul answers.",
          "format": "double",
          "type": "number"
        },
        "type": {
          "enum": [
            "noul"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "noul"
      ],
      "title": "ClassifyNoulAnswer",
      "type": "object"
    },
    "ClassifyRefusalAnswer": {
      "additionalProperties": false,
      "properties": {
        "type": {
          "enum": [
            "refusal"
          ],
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "title": "ClassifyRefusalAnswer",
      "type": "object"
    },
    "ClassifyScoreAnswer": {
      "additionalProperties": false,
      "properties": {
        "confidence": {
          "description": "How sure the model is of the answer it selected: on emulated chat models the largest value in probabilities, so it adds nothing the distribution does not; native providers return their own confidence value, which can sit below the largest probability. Present for choice, score and box answers.",
          "format": "double",
          "type": "number"
        },
        "legend": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Level index to level description. Present for score answers.",
          "type": "object"
        },
        "probabilities": {
          "additionalProperties": {
            "format": "double",
            "type": "number"
          },
          "description": "Probability distribution over the options or levels. Present for choice and score answers.",
          "type": "object"
        },
        "score": {
          "description": "Position on the scale, not an index: on emulated chat models and OpenAI Decisions the weighted index, each level index multiplied by that level probability and summed, so the value is usually fractional; typesafe/jev-latest returns its own score. Present for score answers.",
          "format": "double",
          "type": "number"
        },
        "type": {
          "enum": [
            "score"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "score"
      ],
      "title": "ClassifyScoreAnswer",
      "type": "object"
    }
  }
}