OpenAI APIs · Schema

ChatMessage

Artificial IntelligenceEmbeddingsImage GenerationLanguage ModelsSpeech

Properties

Name Type Description
role string The role of the message author
content object The contents of the message
name string An optional name for the participant
tool_calls array Tool calls generated by the model
tool_call_id string Tool call that this message is responding to
View JSON Schema on GitHub

JSON Schema

openai-apis-chatmessage-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/ChatMessage",
  "title": "ChatMessage",
  "type": "object",
  "required": [
    "role",
    "content"
  ],
  "properties": {
    "role": {
      "type": "string",
      "enum": [
        "system",
        "user",
        "assistant",
        "tool"
      ],
      "description": "The role of the message author"
    },
    "content": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "object"
          }
        }
      ],
      "description": "The contents of the message"
    },
    "name": {
      "type": "string",
      "description": "An optional name for the participant"
    },
    "tool_calls": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/ToolCall"
      },
      "description": "Tool calls generated by the model"
    },
    "tool_call_id": {
      "type": "string",
      "description": "Tool call that this message is responding to"
    }
  }
}