NAME

OpenAPI::Client::OpenAI::Path::threads - Documentation for the /threads path.

OPERATIONS

POST /threads

createThread

$client->create_thread({
    body => { ... },
});

Create a thread.

Request body

Content-Type: application/json

Example:

{
   "created_at" : 1699012949,
   "id" : "thread_abc123",
   "metadata" : {},
   "object" : "thread",
   "tool_resources" : {}
}

Responses

200 - OK

Content-Type: application/json

Example:

{
   "created_at" : 1699012949,
   "id" : "thread_abc123",
   "metadata" : {},
   "object" : "thread",
   "tool_resources" : {}
}

SCHEMAS

CreateMessageRequest

Properties:

  • attachments (anyOf)

  • content (oneOf, required)

  • metadata (Metadata)

    See "Metadata" below for shape.

  • role (string, required) - The role of the entity that is creating the message. Allowed values include: - user : Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. - assistant : Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.

    Allowed values: user, assistant

CreateThreadRequest

Properties:

  • messages (array of CreateMessageRequest) - A list of messages to start the thread with.

  • metadata (Metadata)

    See "Metadata" below for shape.

  • tool_resources (anyOf)

Metadata

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

ThreadObject

Properties:

  • created_at (integer, required) - The Unix timestamp (in seconds) for when the thread was created.

  • id (string, required) - The identifier, which can be referenced in API endpoints.

  • metadata (Metadata, required)

    See "Metadata" below for shape.

  • object (string, required) - The object type, which is always thread .

    Allowed values: thread

  • tool_resources (anyOf, required)

SEE ALSO

OpenAPI::Client::OpenAI::Path

COPYRIGHT AND LICENSE

Copyright (C) 2023-2026 by Nelson Ferraz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.