Baseten · Schema

MessagesResponse

The message response returned by the model.

AIMLInferenceDeploymentMLOpsOpenAI CompatibleAnthropic CompatibleTruss

Properties

Name Type Description
id string A unique identifier for this message, such as `msg_abc123`.
type string The object type, always `message`.
role string The role of the generated message, always `assistant`.
content array An array of content blocks generated by the model. Text responses contain a single `text` block; responses that invoke tools contain `tool_use` blocks.
model string The model slug that produced the response.
stop_reason string Why the model stopped generating: `end_turn` (natural stop), `max_tokens` (hit the `max_tokens` limit), `stop_sequence` (matched a `stop_sequences` entry), or `tool_use` (model invoked a tool).
stop_sequence string The stop sequence that was matched, if `stop_reason` is `stop_sequence`. Otherwise `null`.
usage object Token usage statistics for the request.
View JSON Schema on GitHub

JSON Schema

baseten-messagesresponse-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/MessagesResponse",
  "title": "MessagesResponse",
  "additionalProperties": false,
  "type": "object",
  "required": [
    "id",
    "type",
    "role",
    "content",
    "model",
    "stop_reason",
    "usage"
  ],
  "description": "The message response returned by the model.",
  "properties": {
    "id": {
      "type": "string",
      "description": "A unique identifier for this message, such as `msg_abc123`."
    },
    "type": {
      "const": "message",
      "type": "string",
      "description": "The object type, always `message`."
    },
    "role": {
      "const": "assistant",
      "type": "string",
      "description": "The role of the generated message, always `assistant`."
    },
    "content": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/TextBlock"
          },
          {
            "$ref": "#/components/schemas/ToolUseBlock"
          }
        ]
      },
      "description": "An array of content blocks generated by the model. Text responses contain a single `text` block; responses that invoke tools contain `tool_use` blocks."
    },
    "model": {
      "type": "string",
      "description": "The model slug that produced the response."
    },
    "stop_reason": {
      "type": "string",
      "enum": [
        "end_turn",
        "max_tokens",
        "stop_sequence",
        "tool_use"
      ],
      "description": "Why the model stopped generating: `end_turn` (natural stop), `max_tokens` (hit the `max_tokens` limit), `stop_sequence` (matched a `stop_sequences` entry), or `tool_use` (model invoked a tool)."
    },
    "stop_sequence": {
      "type": "string",
      "nullable": true,
      "description": "The stop sequence that was matched, if `stop_reason` is `stop_sequence`. Otherwise `null`."
    },
    "usage": {
      "$ref": "#/components/schemas/Usage",
      "description": "Token usage statistics for the request."
    }
  }
}