{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sap-btp/json-schema/sap-btp-prompt-template-post-request-schema.json",
  "title": "PromptTemplatePostRequest",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sap-btp-prompt-registry-openapi.yml#/components/schemas/PromptTemplatePostRequest",
  "type": "object",
  "required": [
    "name",
    "version",
    "scenario",
    "spec"
  ],
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 120,
      "pattern": "^[a-zA-Z0-9_-]+$"
    },
    "version": {
      "type": "string",
      "maxLength": 10,
      "pattern": "^[a-zA-Z0-9._-]+$"
    },
    "scenario": {
      "type": "string",
      "maxLength": 120,
      "pattern": "^[a-zA-Z0-9_-]+$"
    },
    "spec": {
      "$ref": "#/$defs/PromptTemplateSpec"
    }
  },
  "$defs": {
    "ChatCompletionTool": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "function"
          ],
          "description": "The type of the tool. Currently, only `function` is supported."
        },
        "function": {
          "$ref": "#/$defs/FunctionObject"
        }
      },
      "required": [
        "type",
        "function"
      ]
    },
    "FunctionObject": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string",
          "description": "A description of what the function does, used by the model to choose when and how to call the function."
        },
        "name": {
          "type": "string",
          "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.",
          "pattern": "^[a-zA-Z0-9-_]+$",
          "maxLength": 64
        },
        "parameters": {
          "$ref": "#/$defs/FunctionParameters"
        },
        "strict": {
          "type": [
            "boolean",
            "null"
          ],
          "default": false,
          "description": "Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling)."
        }
      },
      "required": [
        "name"
      ]
    },
    "FunctionParameters": {
      "type": "object",
      "description": "The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.  Omitting `parameters` defines a function with an empty parameter list.",
      "additionalProperties": true
    },
    "ImageContent": {
      "type": "object",
      "required": [
        "type",
        "image_url"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "image_url"
          ]
        },
        "image_url": {
          "type": "object",
          "required": [
            "url"
          ],
          "additionalProperties": false,
          "properties": {
            "url": {
              "type": "string"
            },
            "detail": {
              "type": "string",
              "default": "auto"
            }
          }
        }
      }
    },
    "MultiChatContent": {
      "oneOf": [
        {
          "$ref": "#/$defs/ImageContent"
        },
        {
          "$ref": "#/$defs/TextContent"
        }
      ]
    },
    "MultiChatTemplate": {
      "type": "object",
      "required": [
        "role",
        "content"
      ],
      "additionalProperties": false,
      "properties": {
        "role": {
          "type": "string"
        },
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MultiChatContent"
          }
        }
      }
    },
    "PromptTemplate": {
      "oneOf": [
        {
          "$ref": "#/$defs/SingleChatTemplate"
        },
        {
          "$ref": "#/$defs/MultiChatTemplate"
        }
      ]
    },
    "PromptTemplateSpec": {
      "type": "object",
      "required": [
        "template"
      ],
      "additionalProperties": {
        "type": "object"
      },
      "properties": {
        "template": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PromptTemplate"
          }
        },
        "defaults": {
          "type": "object"
        },
        "additionalFields": {
          "type": "object",
          "description": "DEPRECATED. Please use additional_fields instead.\n",
          "deprecated": true
        },
        "response_format": {
          "description": "Response format that the model output should adhere to. This is the same as the OpenAI definition.\nCompatible with GPT-4o, GPT-4o mini, GPT-4 (Turbo) and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106.\n",
          "oneOf": [
            {
              "$ref": "#/$defs/ResponseFormatText"
            },
            {
              "$ref": "#/$defs/ResponseFormatJsonObject"
            },
            {
              "$ref": "#/$defs/ResponseFormatJsonSchema"
            }
          ]
        },
        "tools": {
          "type": "array",
          "description": "A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. This is the same as the OpenAI definition.\n",
          "items": {
            "$ref": "#/$defs/ChatCompletionTool"
          }
        }
      }
    },
    "ResponseFormatJsonObject": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "description": "The type of response format being defined: `json_object`",
          "enum": [
            "json_object"
          ]
        }
      },
      "required": [
        "type"
      ]
    },
    "ResponseFormatJsonSchema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "description": "The type of response format being defined: `json_schema`",
          "enum": [
            "json_schema"
          ]
        },
        "json_schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "description": {
              "type": "string",
              "description": "A description of what the response format is for, used by the model to determine how to respond in the format."
            },
            "name": {
              "type": "string",
              "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.",
              "pattern": "^[a-zA-Z0-9-_]+$",
              "maxLength": 64
            },
            "schema": {
              "$ref": "#/$defs/ResponseFormatJsonSchemaSchema"
            },
            "strict": {
              "type": [
                "boolean",
                "null"
              ],
              "default": false,
              "description": "Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs)."
            }
          },
          "required": [
            "name"
          ]
        }
      },
      "required": [
        "type",
        "json_schema"
      ]
    },
    "ResponseFormatJsonSchemaSchema": {
      "type": "object",
      "description": "The schema for the response format, described as a JSON Schema object.",
      "additionalProperties": true
    },
    "ResponseFormatText": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "description": "The type of response format being defined: `text`",
          "enum": [
            "text"
          ]
        }
      },
      "required": [
        "type"
      ]
    },
    "SingleChatTemplate": {
      "type": "object",
      "required": [
        "role",
        "content"
      ],
      "additionalProperties": false,
      "properties": {
        "role": {
          "type": "string"
        },
        "content": {
          "type": "string"
        }
      }
    },
    "TextContent": {
      "type": "object",
      "required": [
        "type",
        "text"
      ],
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text"
          ]
        },
        "text": {
          "type": "string"
        }
      }
    }
  }
}