{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/parallel-ai/json-schema/parallel-ai-grounded-decision-request-schema.json",
  "title": "Decision request",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/parallel-ai-decisions-api-openapi.yml#/components/schemas/GroundedDecisionRequest",
  "properties": {
    "advanced_settings": {
      "anyOf": [
        {
          "$ref": "#/$defs/AdvancedDecisionSettings"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional advanced configuration for decision grounding. When provided, the object must include after_date, location, or include_excerpts."
    },
    "mode": {
      "type": "string",
      "const": "fast",
      "title": "Mode",
      "description": "Decision execution mode.",
      "default": "fast"
    },
    "state": {
      "$ref": "#/$defs/JsonValue",
      "description": "Context shared by all questions. Accepts any JSON value. Together with the largest question, this may use at most 32,000 estimated input tokens."
    },
    "questions": {
      "patternProperties": {
        "^[A-Za-z0-9_-]+$": {
          "oneOf": [
            {
              "$ref": "#/$defs/GroundedChoiceQuestion"
            },
            {
              "$ref": "#/$defs/GroundedScoreQuestion"
            },
            {
              "$ref": "#/$defs/GroundedNoulQuestion"
            }
          ]
        }
      },
      "type": "object",
      "maxProperties": 100,
      "minProperties": 1,
      "title": "Questions",
      "description": "1 to 100 questions keyed by names containing only ASCII letters, numbers, underscores, and hyphens. State plus the largest question may use at most 32,000 estimated input tokens. Each value is a predicate (`noul`), choice, or score question."
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "state",
    "questions"
  ],
  "$defs": {
    "AdvancedDecisionSettings": {
      "properties": {
        "location": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Location",
          "description": "Supported ISO 3166-1 alpha-2 country code for geo-targeted search results. Case-insensitive; normalized to lowercase. Invalid or unsupported codes return a validation error."
        },
        "after_date": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "After Date",
          "description": "Prefer sources published on or after this date (YYYY-MM-DD)."
        },
        "include_excerpts": {
          "type": "boolean",
          "title": "Include Excerpts",
          "description": "Whether citations include the excerpts used to ground the decision. When false, every citation has an empty excerpts array.",
          "default": true
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "AdvancedDecisionSettings",
      "description": "Advanced configuration for decision grounding."
    },
    "GroundedChoiceQuestion": {
      "properties": {
        "type": {
          "type": "string",
          "const": "choice",
          "title": "Type"
        },
        "instructions": {
          "type": "string",
          "title": "Instructions",
          "description": "Question to answer by selecting one of the named options."
        },
        "criteria": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "maxProperties": 255,
          "minProperties": 2,
          "title": "Criteria",
          "description": "2 to 255 options, mapping each option name to its description."
        }
      },
      "type": "object",
      "required": [
        "type",
        "instructions",
        "criteria"
      ],
      "title": "Choice"
    },
    "GroundedNoulCriteria": {
      "properties": {
        "true": {
          "type": "string",
          "title": "True",
          "description": "Meaning of a true outcome."
        },
        "false": {
          "type": "string",
          "title": "False",
          "description": "Meaning of a false outcome."
        }
      },
      "type": "object",
      "required": [
        "true",
        "false"
      ],
      "title": "Criteria"
    },
    "GroundedNoulQuestion": {
      "properties": {
        "type": {
          "type": "string",
          "const": "noul",
          "title": "Type"
        },
        "instructions": {
          "type": "string",
          "title": "Instructions",
          "description": "Condition whose probability of being true should be estimated."
        },
        "criteria": {
          "anyOf": [
            {
              "$ref": "#/$defs/GroundedNoulCriteria"
            },
            {
              "type": "null"
            }
          ],
          "description": "Optional descriptions of what true and false mean for this question."
        }
      },
      "type": "object",
      "required": [
        "type",
        "instructions"
      ],
      "title": "Predicate"
    },
    "GroundedScoreQuestion": {
      "properties": {
        "type": {
          "type": "string",
          "const": "score",
          "title": "Type"
        },
        "instructions": {
          "type": "string",
          "title": "Instructions",
          "description": "Question to evaluate against the ordered criteria."
        },
        "criteria": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 10,
          "minItems": 2,
          "title": "Criteria",
          "description": "2 to 10 level descriptions in order, indexed from zero."
        }
      },
      "type": "object",
      "required": [
        "type",
        "instructions",
        "criteria"
      ],
      "title": "Score"
    },
    "JsonValue": {}
  }
}