{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/azure-ai-search/json-schema/azure-ai-search-knowledge-base-retrieval-request-schema.json",
  "title": "KnowledgeBaseRetrievalRequest",
  "description": "The input contract for the retrieval request.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/azure-ai-search-knowledgebases-knowledgebasename-api-openapi.yml#/components/schemas/KnowledgeBaseRetrievalRequest",
  "type": "object",
  "properties": {
    "messages": {
      "type": "array",
      "description": "A list of chat message style input.",
      "items": {
        "$ref": "#/$defs/KnowledgeBaseMessage"
      }
    },
    "intents": {
      "type": "array",
      "description": "A list of intended queries to execute without model query planning.",
      "items": {
        "$ref": "#/$defs/KnowledgeRetrievalIntent"
      }
    },
    "maxRuntimeInSeconds": {
      "type": "integer",
      "format": "int32",
      "description": "The maximum runtime in seconds."
    },
    "maxOutputDocuments": {
      "type": "integer",
      "format": "int32",
      "description": "Limits the maximum number of documents in the output."
    },
    "maxOutputSizeInTokens": {
      "type": "integer",
      "format": "int32",
      "description": "Limits the maximum size of the content in the output."
    },
    "retrievalReasoningEffort": {
      "$ref": "#/$defs/KnowledgeRetrievalReasoningEffort",
      "description": "The retrieval reasoning effort configuration."
    },
    "includeActivity": {
      "type": "boolean",
      "description": "Indicates retrieval results should include activity information."
    },
    "outputMode": {
      "$ref": "#/$defs/KnowledgeRetrievalOutputMode",
      "description": "The output configuration for this retrieval."
    },
    "knowledgeSourceParams": {
      "type": "array",
      "description": "A list of runtime parameters for the knowledge sources.",
      "items": {
        "$ref": "#/$defs/KnowledgeSourceParams"
      }
    }
  },
  "$defs": {
    "KnowledgeBaseMessage": {
      "type": "object",
      "description": "The natural language message style object.",
      "properties": {
        "role": {
          "type": "string",
          "description": "The role of the tool response."
        },
        "content": {
          "type": "array",
          "description": "The content of the message.",
          "items": {
            "$ref": "#/$defs/KnowledgeBaseMessageContent"
          }
        }
      },
      "required": [
        "content"
      ]
    },
    "KnowledgeBaseMessageContent": {
      "type": "object",
      "description": "Specifies the type of the message content.",
      "properties": {
        "type": {
          "$ref": "#/$defs/KnowledgeBaseMessageContentType",
          "description": "The type of the message"
        }
      },
      "required": [
        "type"
      ]
    },
    "KnowledgeBaseMessageContentType": {
      "type": "string",
      "description": "The type of message content.",
      "enum": [
        "text",
        "image"
      ],
      "x-ms-enum": {
        "name": "KnowledgeBaseMessageContentType",
        "modelAsString": true,
        "values": [
          {
            "name": "text",
            "value": "text",
            "description": "Text message content kind."
          },
          {
            "name": "image",
            "value": "image",
            "description": "Image message content kind."
          }
        ]
      }
    },
    "KnowledgeRetrievalIntent": {
      "type": "object",
      "description": "An intended query to execute without model query planning.",
      "properties": {
        "type": {
          "$ref": "#/$defs/KnowledgeRetrievalIntentType",
          "description": "The type of the intent."
        }
      },
      "required": [
        "type"
      ]
    },
    "KnowledgeRetrievalIntentType": {
      "type": "string",
      "description": "The kind of knowledge base configuration to use.",
      "enum": [
        "semantic"
      ],
      "x-ms-enum": {
        "name": "KnowledgeRetrievalIntentType",
        "modelAsString": true,
        "values": [
          {
            "name": "semantic",
            "value": "semantic",
            "description": "A natural language semantic query intent."
          }
        ]
      }
    },
    "KnowledgeRetrievalOutputMode": {
      "type": "string",
      "description": "The output configuration for this retrieval.",
      "enum": [
        "extractiveData",
        "answerSynthesis"
      ],
      "x-ms-enum": {
        "name": "KnowledgeRetrievalOutputMode",
        "modelAsString": true,
        "values": [
          {
            "name": "extractiveData",
            "value": "extractiveData",
            "description": "Return data from the knowledge sources directly without generative alteration."
          },
          {
            "name": "answerSynthesis",
            "value": "answerSynthesis",
            "description": "Synthesize an answer for the response payload."
          }
        ]
      }
    },
    "KnowledgeRetrievalReasoningEffort": {
      "type": "object",
      "description": "Base type for reasoning effort.",
      "properties": {
        "kind": {
          "$ref": "#/$defs/KnowledgeRetrievalReasoningEffortKind",
          "description": "The kind of reasoning effort."
        }
      },
      "required": [
        "kind"
      ]
    },
    "KnowledgeRetrievalReasoningEffortKind": {
      "type": "string",
      "description": "The amount of effort to use during retrieval.",
      "enum": [
        "minimal",
        "low",
        "medium"
      ],
      "x-ms-enum": {
        "name": "KnowledgeRetrievalReasoningEffortKind",
        "modelAsString": true,
        "values": [
          {
            "name": "minimal",
            "value": "minimal",
            "description": "Does not perform any source selections, query planning, or iterative search."
          },
          {
            "name": "low",
            "value": "low",
            "description": "Use low reasoning during retrieval."
          },
          {
            "name": "medium",
            "value": "medium",
            "description": "Use a moderate amount of reasoning during retrieval."
          }
        ]
      }
    },
    "KnowledgeSourceKind": {
      "type": "string",
      "description": "The kind of the knowledge source.",
      "enum": [
        "searchIndex",
        "azureBlob",
        "indexedSharePoint",
        "indexedOneLake",
        "indexedSql",
        "web",
        "file"
      ],
      "x-ms-enum": {
        "name": "KnowledgeSourceKind",
        "modelAsString": true,
        "values": [
          {
            "name": "SearchIndex",
            "value": "searchIndex",
            "description": "A knowledge source that reads data from a Search Index."
          },
          {
            "name": "AzureBlob",
            "value": "azureBlob",
            "description": "A knowledge source that read and ingest data from Azure Blob Storage to a Search Index."
          },
          {
            "name": "IndexedSharePoint",
            "value": "indexedSharePoint",
            "description": "A knowledge source that reads data from indexed SharePoint."
          },
          {
            "name": "IndexedOneLake",
            "value": "indexedOneLake",
            "description": "A knowledge source that reads data from indexed OneLake."
          },
          {
            "name": "IndexedSql",
            "value": "indexedSql",
            "description": "A knowledge source that retrieves and ingests data from Azure SQL Database or SQL Managed Instance to a Search Index."
          },
          {
            "name": "Web",
            "value": "web",
            "description": "A knowledge source that reads data from the web."
          },
          {
            "name": "File",
            "value": "file",
            "description": "A knowledge source that supports direct file upload and indexing."
          }
        ]
      }
    },
    "KnowledgeSourceParams": {
      "type": "object",
      "description": "Base type for knowledge source runtime parameters.",
      "properties": {
        "knowledgeSourceName": {
          "type": "string",
          "description": "The name of the index the params apply to."
        },
        "includeReferences": {
          "type": "boolean",
          "description": "Indicates whether references should be included for data retrieved from this source."
        },
        "includeReferenceSourceData": {
          "type": "boolean",
          "description": "Indicates whether references should include the structured data obtained during retrieval in their payload."
        },
        "alwaysQuerySource": {
          "type": "boolean",
          "description": "Indicates that this knowledge source should bypass source selection and always be queried at retrieval time."
        },
        "failOnError": {
          "type": "boolean",
          "description": "Indicates that the entire retrieval request should fail if retrieval from this knowledge source encounters an error. Defaults to false."
        },
        "rerankerThreshold": {
          "type": "number",
          "format": "float",
          "description": "The reranker threshold all retrieved documents must meet to be included in the response."
        },
        "maxOutputDocuments": {
          "type": "integer",
          "format": "int32",
          "description": "Limits the maximum number of documents returned from this knowledge source."
        },
        "kind": {
          "$ref": "#/$defs/KnowledgeSourceKind",
          "description": "The type of the knowledge source."
        }
      },
      "required": [
        "knowledgeSourceName",
        "kind"
      ]
    }
  }
}