{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/azure-ai-foundry/json-schema/azure-ai-foundry-build-document-model-request-schema.json",
  "title": "BuildDocumentModelRequest",
  "description": "Request body to build a new custom document model.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/azure-ai-foundry-document-models-build-api-openapi.yml#/components/schemas/BuildDocumentModelRequest",
  "type": "object",
  "properties": {
    "modelId": {
      "type": "string",
      "description": "Unique document model name.",
      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._~-]{1,63}$"
    },
    "description": {
      "type": "string",
      "description": "Document model description.",
      "maxLength": 4096
    },
    "buildMode": {
      "$ref": "#/$defs/DocumentBuildMode",
      "description": "Custom document model build mode."
    },
    "azureBlobSource": {
      "$ref": "#/$defs/AzureBlobContentSource",
      "description": "Azure Blob Storage location containing the training data.  Either\nazureBlobSource or azureBlobFileListSource must be specified."
    },
    "azureBlobFileListSource": {
      "$ref": "#/$defs/AzureBlobFileListContentSource",
      "description": "Azure Blob Storage file list specifying the training data.  Either\nazureBlobSource or azureBlobFileListSource must be specified."
    },
    "tags": {
      "type": "object",
      "description": "List of key-value tag attributes associated with the document model.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "maxTrainingHours": {
      "type": "number",
      "format": "float",
      "description": "Max number of V100-equivalent GPU hours to use for model training.  Default=0.5.",
      "default": 0.5
    },
    "allowOverwrite": {
      "type": "boolean",
      "description": "Allow overwriting an existing model with the same name.",
      "default": false
    }
  },
  "required": [
    "modelId",
    "buildMode"
  ],
  "$defs": {
    "AzureBlobContentSource": {
      "type": "object",
      "description": "Azure Blob Storage content.",
      "properties": {
        "containerUrl": {
          "type": "string",
          "format": "uri",
          "description": "Azure Blob Storage container URL."
        },
        "prefix": {
          "type": "string",
          "description": "Blob name prefix."
        }
      },
      "required": [
        "containerUrl"
      ]
    },
    "AzureBlobFileListContentSource": {
      "type": "object",
      "description": "File list in Azure Blob Storage.",
      "properties": {
        "containerUrl": {
          "type": "string",
          "format": "uri",
          "description": "Azure Blob Storage container URL."
        },
        "fileList": {
          "type": "string",
          "description": "Path to a JSONL file within the container specifying a subset of documents."
        }
      },
      "required": [
        "containerUrl",
        "fileList"
      ]
    },
    "DocumentBuildMode": {
      "type": "string",
      "description": "Custom document model build mode.",
      "enum": [
        "template",
        "neural"
      ],
      "x-ms-enum": {
        "name": "DocumentBuildMode",
        "modelAsString": true,
        "values": [
          {
            "name": "template",
            "value": "template",
            "description": "Target documents with similar visual templates."
          },
          {
            "name": "neural",
            "value": "neural",
            "description": "Support documents with diverse visual templates."
          }
        ]
      }
    }
  }
}