Create Thread

Go to Product

Create a thread.

Options

OpenAI Beta
Calls to the Assistants API require that you pass a beta HTTP header.
Body

Request body which must comply to the following JSON Schema:

{
  "type" : "object",
  "properties" : {
    "messages" : {
      "type" : "array",
      "description" : "A list of [messages](/docs/api-reference/messages) to start the thread with.",
      "items" : {
        "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
      }
    },
    "tool_resources" : {
      "type" : "object",
      "properties" : {
        "code_interpreter" : {
          "type" : "object",
          "properties" : {
            "file_ids" : {
              "maxItems" : 20,
              "type" : "array",
              "description" : "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n",
              "items" : {
                "type" : "string"
              },
              "default" : [ ]
            }
          }
        },
        "file_search" : {
          "type" : "object",
          "properties" : {
            "vector_store_ids" : {
              "maxItems" : 1,
              "type" : "array",
              "description" : "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n",
              "items" : {
                "type" : "string"
              }
            },
            "vector_stores" : {
              "maxItems" : 1,
              "type" : "array",
              "description" : "A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.\n",
              "items" : {
                "type" : "object",
                "properties" : {
                  "file_ids" : {
                    "maxItems" : 10000,
                    "type" : "array",
                    "description" : "A list of [file](/docs/api-reference/files) IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.\n",
                    "items" : {
                      "type" : "string"
                    }
                  },
                  "chunking_strategy" : {
                    "type" : "object",
                    "description" : "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.",
                    "oneOf" : [ {
                      "title" : "Auto Chunking Strategy",
                      "required" : [ "type" ],
                      "type" : "object",
                      "properties" : {
                        "type" : {
                          "type" : "string",
                          "description" : "Always `auto`.",
                          "enum" : [ "auto" ]
                        }
                      },
                      "additionalProperties" : false,
                      "description" : "The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`."
                    }, {
                      "title" : "Static Chunking Strategy",
                      "required" : [ "static", "type" ],
                      "type" : "object",
                      "properties" : {
                        "type" : {
                          "type" : "string",
                          "description" : "Always `static`.",
                          "enum" : [ "static" ]
                        },
                        "static" : {
                          "required" : [ "chunk_overlap_tokens", "max_chunk_size_tokens" ],
                          "type" : "object",
                          "properties" : {
                            "max_chunk_size_tokens" : {
                              "maximum" : 4096,
                              "minimum" : 100,
                              "type" : "integer",
                              "description" : "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."
                            },
                            "chunk_overlap_tokens" : {
                              "type" : "integer",
                              "description" : "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"
                            }
                          },
                          "additionalProperties" : false
                        }
                      },
                      "additionalProperties" : false
                    } ],
                    "x-oaiExpandable" : true
                  },
                  "metadata" : {
                    "type" : "object",
                    "description" : "Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.\n",
                    "x-oaiTypeLabel" : "map"
                  }
                },
                "x-oaiExpandable" : true
              }
            }
          },
          "oneOf" : [ {
            "required" : [ "vector_store_ids" ]
          }, {
            "required" : [ "vector_stores" ]
          } ]
        }
      },
      "description" : "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n",
      "nullable" : 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.