threads
Creates, updates, deletes, gets or lists a threads
resource.
Overview
Name | threads |
Type | Resource |
Id | openai.assistants.threads |
Fields
Name | Datatype | Description |
---|---|---|
id | string | The identifier, which can be referenced in API endpoints. |
created_at | integer | The Unix timestamp (in seconds) for when the thread was created. |
metadata | object | 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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long. |
object | string | The object type, which is always thread . |
tool_resources | object | 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. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get_thread | SELECT | thread_id | |
create_thread | INSERT |
| |
delete_thread | DELETE | thread_id | |
modify_thread | UPDATE | thread_id | |
create_thread_and_run | EXEC | data__assistant_id |
SELECT
examples
SELECT
id,
created_at,
metadata,
object,
tool_resources
FROM openai.assistants.threads
WHERE thread_id = '{{ thread_id }}';
INSERT
example
Use the following StackQL query and manifest file to create a new threads
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO openai.assistants.threads (
data__messages,
data__tool_resources,
data__metadata
)
SELECT
'{{ messages }}',
'{{ tool_resources }}',
'{{ metadata }}'
;
- name: threads
props:
- name: messages
value: array
props:
- name: role
value: string
- name: content
value: string
- name: attachments
value: array
props:
- name: file_id
value: string
- name: tools
value: array
props:
- name: type
value: string
- name: metadata
value: object
- name: tool_resources
props:
- name: code_interpreter
props:
- name: file_ids
value: array
- name: file_search
value: string
- name: metadata
value: object
UPDATE
example
Updates a threads
resource.
/*+ update */
UPDATE openai.assistants.threads
SET
tool_resources = '{{ tool_resources }}',
metadata = '{{ metadata }}'
WHERE
thread_id = '{{ thread_id }}';
DELETE
example
Deletes the specified threads
resource.
/*+ delete */
DELETE FROM openai.assistants.threads
WHERE thread_id = '{{ thread_id }}';