Create Message

Go to Product

Create a message.

Options

OpenAI Beta
Calls to the Assistants API require that you pass a beta HTTP header.
Thread Id
The ID of the thread to create a message for.
Body

Request body which must comply to the following JSON Schema:

{
  "required" : [ "content", "role" ],
  "type" : "object",
  "properties" : {
    "role" : {
      "type" : "string",
      "description" : "The role of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.\n",
      "enum" : [ "user", "assistant" ]
    },
    "content" : {
      "oneOf" : [ {
        "title" : "Text content",
        "type" : "string",
        "description" : "The text contents of the message."
      }, {
        "title" : "Array of content parts",
        "minItems" : 1,
        "type" : "array",
        "description" : "An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/docs/models/overview).",
        "items" : {
          "oneOf" : [ {
            "title" : "Image file",
            "required" : [ "image_file", "type" ],
            "type" : "object",
            "properties" : {
              "type" : {
                "type" : "string",
                "description" : "Always `image_file`.",
                "enum" : [ "image_file" ]
              },
              "image_file" : {
                "required" : [ "file_id" ],
                "type" : "object",
                "properties" : {
                  "file_id" : {
                    "type" : "string",
                    "description" : "The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content."
                  },
                  "detail" : {
                    "type" : "string",
                    "description" : "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.",
                    "default" : "auto",
                    "enum" : [ "auto", "low", "high" ]
                  }
                }
              }
            },
            "description" : "References an image [File](/docs/api-reference/files) in the content of a message."
          }, {
            "title" : "Image URL",
            "required" : [ "image_url", "type" ],
            "type" : "object",
            "properties" : {
              "type" : {
                "type" : "string",
                "description" : "The type of the content part.",
                "enum" : [ "image_url" ]
              },
              "image_url" : {
                "required" : [ "url" ],
                "type" : "object",
                "properties" : {
                  "url" : {
                    "type" : "string",
                    "description" : "The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.",
                    "format" : "uri"
                  },
                  "detail" : {
                    "type" : "string",
                    "description" : "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`",
                    "default" : "auto",
                    "enum" : [ "auto", "low", "high" ]
                  }
                }
              }
            },
            "description" : "References an image URL in the content of a message."
          }, {
            "title" : "Text",
            "required" : [ "text", "type" ],
            "type" : "object",
            "properties" : {
              "type" : {
                "type" : "string",
                "description" : "Always `text`.",
                "enum" : [ "text" ]
              },
              "text" : {
                "type" : "string",
                "description" : "Text content to be sent to the model"
              }
            },
            "description" : "The text content that is part of a message."
          } ],
          "x-oaiExpandable" : true
        }
      } ],
      "x-oaiExpandable" : true
    },
    "attachments" : {
      "required" : [ "file_id", "tools" ],
      "type" : "array",
      "description" : "A list of files attached to the message, and the tools they should be added to.",
      "nullable" : true,
      "items" : {
        "type" : "object",
        "properties" : {
          "file_id" : {
            "type" : "string",
            "description" : "The ID of the file to attach to the message."
          },
          "tools" : {
            "type" : "array",
            "description" : "The tools to add this file to.",
            "items" : {
              "oneOf" : [ {
                "title" : "Code interpreter tool",
                "required" : [ "type" ],
                "type" : "object",
                "properties" : {
                  "type" : {
                    "type" : "string",
                    "description" : "The type of tool being defined: `code_interpreter`",
                    "enum" : [ "code_interpreter" ]
                  }
                }
              }, {
                "title" : "FileSearch tool",
                "required" : [ "type" ],
                "type" : "object",
                "properties" : {
                  "type" : {
                    "type" : "string",
                    "description" : "The type of tool being defined: `file_search`",
                    "enum" : [ "file_search" ]
                  }
                }
              } ],
              "x-oaiExpandable" : true
            }
          }
        }
      }
    },
    "metadata" : {
      "type" : "object",
      "description" : "metadata_description",
      "nullable" : true,
      "x-oaiTypeLabel" : "map"
    }
  },
  "additionalProperties" : false
}
Result Format

Specify how the response should be mapped to the table output. The following formats are available:

Raw Response: Returns the raw response in a single row with the following columns:

  • body: Response body
  • status: HTTP status code

Input Ports

Icon
Configuration data.

Output Ports

Icon
Result of the request depending on the selected Result Format.
Icon
Configuration data (this is the same as the input port; it is provided as passthrough for sequentially chaining nodes to declutter your workflow connections).

Popular Predecessors

  • No recommendations found

Popular Successors

  • No recommendations found

Views

This node has no views

Workflows

  • No workflows found

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.