{
  "$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-response-schema.json",
  "title": "KnowledgeBaseRetrievalResponse",
  "description": "The output contract for the retrieval response.",
  "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/KnowledgeBaseRetrievalResponse",
  "type": "object",
  "properties": {
    "response": {
      "type": "array",
      "description": "The response messages.",
      "items": {
        "$ref": "#/$defs/KnowledgeBaseMessage"
      }
    },
    "activity": {
      "type": "array",
      "description": "The activity records for tracking progress and billing implications.",
      "items": {
        "$ref": "#/$defs/KnowledgeBaseActivityRecord"
      }
    },
    "references": {
      "type": "array",
      "description": "The references for the retrieval data used in the response.",
      "items": {
        "$ref": "#/$defs/KnowledgeBaseReference"
      }
    }
  },
  "$defs": {
    "KnowledgeBaseActivityRecord": {
      "type": "object",
      "description": "Base type for activity records. Tracks execution details, timing, and errors for knowledge base operations.",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int32",
          "description": "The ID of the activity record."
        },
        "type": {
          "$ref": "#/$defs/KnowledgeBaseActivityRecordType",
          "description": "The type of the activity record."
        },
        "startedAt": {
          "type": "string",
          "format": "date-time",
          "description": "The time at which the activity started."
        },
        "completedAt": {
          "type": "string",
          "format": "date-time",
          "description": "The time at which the activity completed."
        },
        "elapsedMs": {
          "type": "integer",
          "format": "int32",
          "description": "The elapsed time in milliseconds for the retrieval activity."
        },
        "error": {
          "$ref": "#/$defs/KnowledgeBaseErrorDetail",
          "description": "The error detail explaining why the operation failed. This property is only included when the activity does not succeed."
        },
        "warning": {
          "type": "string",
          "description": "A warning message surfacing potential configuration issues observed during the activity, such as documents dropped due to score thresholding, token limit truncation, or timeout conditions."
        }
      },
      "required": [
        "id",
        "type"
      ]
    },
    "KnowledgeBaseActivityRecordType": {
      "type": "string",
      "description": "The type of activity record.",
      "enum": [
        "searchIndex",
        "azureBlob",
        "indexedSharePoint",
        "indexedOneLake",
        "web",
        "file",
        "indexedSql",
        "modelQueryPlanning",
        "modelAnswerSynthesis",
        "modelWebSummarization",
        "agenticReasoning"
      ],
      "x-ms-enum": {
        "name": "KnowledgeBaseActivityRecordType",
        "modelAsString": true,
        "values": [
          {
            "name": "searchIndex",
            "value": "searchIndex",
            "description": "Search index retrieval activity."
          },
          {
            "name": "azureBlob",
            "value": "azureBlob",
            "description": "Azure Blob retrieval activity."
          },
          {
            "name": "indexedSharePoint",
            "value": "indexedSharePoint",
            "description": "Indexed SharePoint retrieval activity."
          },
          {
            "name": "indexedOneLake",
            "value": "indexedOneLake",
            "description": "Indexed OneLake retrieval activity."
          },
          {
            "name": "web",
            "value": "web",
            "description": "Web retrieval activity."
          },
          {
            "name": "file",
            "value": "file",
            "description": "File retrieval activity."
          },
          {
            "name": "indexedSql",
            "value": "indexedSql",
            "description": "Indexed SQL retrieval activity."
          },
          {
            "name": "modelQueryPlanning",
            "value": "modelQueryPlanning",
            "description": "LLM query planning activity."
          },
          {
            "name": "modelAnswerSynthesis",
            "value": "modelAnswerSynthesis",
            "description": "LLM answer synthesis activity."
          },
          {
            "name": "modelWebSummarization",
            "value": "modelWebSummarization",
            "description": "LLM web summarization activity."
          },
          {
            "name": "agenticReasoning",
            "value": "agenticReasoning",
            "description": "Agentic reasoning activity."
          }
        ]
      }
    },
    "KnowledgeBaseErrorAdditionalInfo": {
      "type": "object",
      "description": "The resource management error additional info.",
      "properties": {
        "type": {
          "type": "string",
          "description": "The additional info type.",
          "readOnly": true
        },
        "info": {
          "type": "object",
          "description": "The additional info.",
          "additionalProperties": {},
          "readOnly": true
        }
      }
    },
    "KnowledgeBaseErrorDetail": {
      "type": "object",
      "description": "The error details.",
      "properties": {
        "code": {
          "type": "string",
          "description": "The error code.",
          "readOnly": true
        },
        "message": {
          "type": "string",
          "description": "The error message.",
          "readOnly": true
        },
        "target": {
          "type": "string",
          "description": "The error target.",
          "readOnly": true
        },
        "details": {
          "type": "array",
          "description": "The error details.",
          "items": {
            "$ref": "#/$defs/KnowledgeBaseErrorDetail"
          },
          "readOnly": true,
          "x-ms-identifiers": []
        },
        "additionalInfo": {
          "type": "array",
          "description": "The error additional info.",
          "items": {
            "$ref": "#/$defs/KnowledgeBaseErrorAdditionalInfo"
          },
          "readOnly": true,
          "x-ms-identifiers": []
        }
      }
    },
    "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."
          }
        ]
      }
    },
    "KnowledgeBaseReference": {
      "type": "object",
      "description": "Base type for references.",
      "properties": {
        "type": {
          "$ref": "#/$defs/KnowledgeBaseReferenceType",
          "description": "The type of the reference."
        },
        "id": {
          "type": "string",
          "description": "The ID of the reference."
        },
        "activitySource": {
          "type": "integer",
          "format": "int32",
          "description": "The source activity ID for the reference."
        },
        "sourceData": {
          "type": "object",
          "description": "The source data for the reference.",
          "additionalProperties": {}
        },
        "rerankerScore": {
          "type": "number",
          "format": "float",
          "description": "The reranker score for the document reference."
        }
      },
      "required": [
        "type",
        "id",
        "activitySource"
      ]
    },
    "KnowledgeBaseReferenceType": {
      "type": "string",
      "description": "The type of reference.",
      "enum": [
        "searchIndex",
        "azureBlob",
        "indexedSharePoint",
        "indexedOneLake",
        "web",
        "file",
        "indexedSql"
      ],
      "x-ms-enum": {
        "name": "KnowledgeBaseReferenceType",
        "modelAsString": true,
        "values": [
          {
            "name": "searchIndex",
            "value": "searchIndex",
            "description": "Search index document reference."
          },
          {
            "name": "azureBlob",
            "value": "azureBlob",
            "description": "Azure Blob document reference."
          },
          {
            "name": "indexedSharePoint",
            "value": "indexedSharePoint",
            "description": "Indexed SharePoint document reference."
          },
          {
            "name": "indexedOneLake",
            "value": "indexedOneLake",
            "description": "Indexed OneLake document reference."
          },
          {
            "name": "web",
            "value": "web",
            "description": "Web document reference."
          },
          {
            "name": "file",
            "value": "file",
            "description": "File document reference."
          },
          {
            "name": "indexedSql",
            "value": "indexedSql",
            "description": "Indexed SQL document reference."
          }
        ]
      }
    }
  }
}