resources/beta/subresources/threads/methods/update/index.md +0 −146 deleted
File Deleted View Diff
1## Modify thread
2
3**post** `/threads/{thread_id}`
4
5Modifies a thread.
6
7### Path Parameters
8
9- `thread_id: string`
10
11### Body Parameters
12
13- `metadata: optional Metadata or null`
14
15 Set of 16 key-value pairs that can be attached to an object. This can be
16 useful for storing additional information about the object in a structured
17 format, and querying for objects via API or the dashboard.
18
19 Keys are strings with a maximum length of 64 characters. Values are strings
20 with a maximum length of 512 characters.
21
22- `tool_resources: optional object { code_interpreter, file_search } or null`
23
24 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.
25
26 - `code_interpreter: optional object { file_ids }`
27
28 - `file_ids: optional array of string`
29
30 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.
31
32 - `file_search: optional object { vector_store_ids }`
33
34 - `vector_store_ids: optional array of string`
35
36 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.
37
38### Returns
39
40- `Thread object { id, created_at, metadata, 2 more }`
41
42 Represents a thread that contains [messages](/docs/api-reference/messages).
43
44 - `id: string`
45
46 The identifier, which can be referenced in API endpoints.
47
48 - `created_at: number`
49
50 The Unix timestamp (in seconds) for when the thread was created.
51
52 - `metadata: Metadata or null`
53
54 Set of 16 key-value pairs that can be attached to an object. This can be
55 useful for storing additional information about the object in a structured
56 format, and querying for objects via API or the dashboard.
57
58 Keys are strings with a maximum length of 64 characters. Values are strings
59 with a maximum length of 512 characters.
60
61 - `object: "thread"`
62
63 The object type, which is always `thread`.
64
65 - `"thread"`
66
67 - `tool_resources: object { code_interpreter, file_search } or null`
68
69 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.
70
71 - `code_interpreter: optional object { file_ids }`
72
73 - `file_ids: optional array of string`
74
75 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.
76
77 - `file_search: optional object { vector_store_ids }`
78
79 - `vector_store_ids: optional array of string`
80
81 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.
82
83### Example
84
85```http
86curl https://api.openai.com/v1/threads/$THREAD_ID \
87 -H 'Content-Type: application/json' \
88 -H 'OpenAI-Beta: assistants=v2' \
89 -H "Authorization: Bearer $OPENAI_API_KEY" \
90 -d '{}'
91```
92
93#### Response
94
95```json
96{
97 "id": "id",
98 "created_at": 0,
99 "metadata": {
100 "foo": "string"
101 },
102 "object": "thread",
103 "tool_resources": {
104 "code_interpreter": {
105 "file_ids": [
106 "string"
107 ]
108 },
109 "file_search": {
110 "vector_store_ids": [
111 "string"
112 ]
113 }
114 }
115}
116```
117
118### Example
119
120```http
121curl https://api.openai.com/v1/threads/thread_abc123 \
122 -H "Content-Type: application/json" \
123 -H "Authorization: Bearer $OPENAI_API_KEY" \
124 -H "OpenAI-Beta: assistants=v2" \
125 -d '{
126 "metadata": {
127 "modified": "true",
128 "user": "abc123"
129 }
130 }'
131```
132
133#### Response
134
135```json
136{
137 "id": "thread_abc123",
138 "object": "thread",
139 "created_at": 1699014083,
140 "metadata": {
141 "modified": "true",
142 "user": "abc123"
143 },
144 "tool_resources": {}
145}
146```