openai 4.35.0 → 4.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +16 -2
  3. package/index.d.mts +8 -1
  4. package/index.d.ts +8 -1
  5. package/index.d.ts.map +1 -1
  6. package/index.js +5 -1
  7. package/index.js.map +1 -1
  8. package/index.mjs +5 -1
  9. package/index.mjs.map +1 -1
  10. package/lib/AssistantStream.d.ts +2 -2
  11. package/lib/AssistantStream.d.ts.map +1 -1
  12. package/lib/Util.d.ts +5 -0
  13. package/lib/Util.d.ts.map +1 -0
  14. package/lib/Util.js +26 -0
  15. package/lib/Util.js.map +1 -0
  16. package/lib/Util.mjs +22 -0
  17. package/lib/Util.mjs.map +1 -0
  18. package/package.json +1 -1
  19. package/resources/beta/{assistants/assistants.d.ts → assistants.d.ts} +217 -41
  20. package/resources/beta/assistants.d.ts.map +1 -0
  21. package/resources/beta/{assistants/assistants.js → assistants.js} +6 -13
  22. package/resources/beta/assistants.js.map +1 -0
  23. package/resources/beta/{assistants/assistants.mjs → assistants.mjs} +6 -13
  24. package/resources/beta/assistants.mjs.map +1 -0
  25. package/resources/beta/beta.d.ts +11 -2
  26. package/resources/beta/beta.d.ts.map +1 -1
  27. package/resources/beta/beta.js +5 -1
  28. package/resources/beta/beta.js.map +1 -1
  29. package/resources/beta/beta.mjs +5 -1
  30. package/resources/beta/beta.mjs.map +1 -1
  31. package/resources/beta/index.d.ts +2 -1
  32. package/resources/beta/index.d.ts.map +1 -1
  33. package/resources/beta/index.js +11 -8
  34. package/resources/beta/index.js.map +1 -1
  35. package/resources/beta/index.mjs +2 -1
  36. package/resources/beta/index.mjs.map +1 -1
  37. package/resources/beta/threads/index.d.ts +1 -1
  38. package/resources/beta/threads/index.d.ts.map +1 -1
  39. package/resources/beta/threads/index.js +6 -6
  40. package/resources/beta/threads/index.js.map +1 -1
  41. package/resources/beta/threads/index.mjs +1 -1
  42. package/resources/beta/threads/{messages/messages.d.ts → messages.d.ts} +27 -28
  43. package/resources/beta/threads/messages.d.ts.map +1 -0
  44. package/resources/beta/threads/{messages/messages.js → messages.js} +5 -12
  45. package/resources/beta/threads/messages.js.map +1 -0
  46. package/resources/beta/threads/{messages/messages.mjs → messages.mjs} +5 -12
  47. package/resources/beta/threads/messages.mjs.map +1 -0
  48. package/resources/beta/threads/runs/index.d.ts +1 -1
  49. package/resources/beta/threads/runs/index.d.ts.map +1 -1
  50. package/resources/beta/threads/runs/runs.d.ts +75 -29
  51. package/resources/beta/threads/runs/runs.d.ts.map +1 -1
  52. package/resources/beta/threads/runs/runs.js +6 -6
  53. package/resources/beta/threads/runs/runs.js.map +1 -1
  54. package/resources/beta/threads/runs/runs.mjs +6 -6
  55. package/resources/beta/threads/runs/runs.mjs.map +1 -1
  56. package/resources/beta/threads/runs/steps.d.ts +40 -40
  57. package/resources/beta/threads/runs/steps.d.ts.map +1 -1
  58. package/resources/beta/threads/runs/steps.js +2 -2
  59. package/resources/beta/threads/runs/steps.mjs +2 -2
  60. package/resources/beta/threads/threads.d.ts +498 -32
  61. package/resources/beta/threads/threads.d.ts.map +1 -1
  62. package/resources/beta/threads/threads.js +6 -6
  63. package/resources/beta/threads/threads.js.map +1 -1
  64. package/resources/beta/threads/threads.mjs +6 -6
  65. package/resources/beta/threads/threads.mjs.map +1 -1
  66. package/resources/beta/vector-stores/file-batches.d.ts +142 -0
  67. package/resources/beta/vector-stores/file-batches.d.ts.map +1 -0
  68. package/resources/beta/vector-stores/file-batches.js +128 -0
  69. package/resources/beta/vector-stores/file-batches.js.map +1 -0
  70. package/resources/beta/vector-stores/file-batches.mjs +124 -0
  71. package/resources/beta/vector-stores/file-batches.mjs.map +1 -0
  72. package/resources/beta/vector-stores/files.d.ts +148 -0
  73. package/resources/beta/vector-stores/files.d.ts.map +1 -0
  74. package/resources/beta/vector-stores/files.js +148 -0
  75. package/resources/beta/vector-stores/files.js.map +1 -0
  76. package/resources/beta/vector-stores/files.mjs +120 -0
  77. package/resources/beta/vector-stores/files.mjs.map +1 -0
  78. package/resources/beta/vector-stores/index.d.ts +4 -0
  79. package/resources/beta/vector-stores/index.d.ts.map +1 -0
  80. package/resources/beta/vector-stores/index.js +13 -0
  81. package/resources/beta/vector-stores/index.js.map +1 -0
  82. package/resources/beta/vector-stores/index.mjs +5 -0
  83. package/resources/beta/vector-stores/index.mjs.map +1 -0
  84. package/resources/beta/vector-stores/vector-stores.d.ts +233 -0
  85. package/resources/beta/vector-stores/vector-stores.d.ts.map +1 -0
  86. package/resources/beta/vector-stores/vector-stores.js +99 -0
  87. package/resources/beta/vector-stores/vector-stores.js.map +1 -0
  88. package/resources/beta/vector-stores/vector-stores.mjs +71 -0
  89. package/resources/beta/vector-stores/vector-stores.mjs.map +1 -0
  90. package/resources/chat/chat.d.ts +3 -0
  91. package/resources/chat/chat.d.ts.map +1 -1
  92. package/resources/chat/chat.js.map +1 -1
  93. package/resources/chat/chat.mjs.map +1 -1
  94. package/resources/chat/completions.d.ts +2 -1
  95. package/resources/chat/completions.d.ts.map +1 -1
  96. package/resources/chat/completions.js.map +1 -1
  97. package/resources/chat/completions.mjs.map +1 -1
  98. package/resources/chat/index.d.ts +1 -1
  99. package/resources/chat/index.d.ts.map +1 -1
  100. package/resources/chat/index.js +3 -3
  101. package/resources/chat/index.js.map +1 -1
  102. package/resources/chat/index.mjs +1 -1
  103. package/resources/chat/index.mjs.map +1 -1
  104. package/resources/fine-tuning/jobs/jobs.d.ts +1 -1
  105. package/src/index.ts +12 -0
  106. package/src/lib/AssistantStream.ts +2 -2
  107. package/src/lib/Util.ts +23 -0
  108. package/src/resources/beta/{assistants/assistants.ts → assistants.ts} +254 -58
  109. package/src/resources/beta/beta.ts +11 -2
  110. package/src/resources/beta/index.ts +11 -2
  111. package/src/resources/beta/threads/index.ts +1 -1
  112. package/src/resources/beta/threads/{messages/messages.ts → messages.ts} +39 -38
  113. package/src/resources/beta/threads/runs/index.ts +2 -2
  114. package/src/resources/beta/threads/runs/runs.ts +94 -36
  115. package/src/resources/beta/threads/runs/steps.ts +49 -49
  116. package/src/resources/beta/threads/threads.ts +571 -37
  117. package/src/resources/beta/vector-stores/file-batches.ts +292 -0
  118. package/src/resources/beta/vector-stores/files.ts +277 -0
  119. package/src/resources/beta/vector-stores/index.ts +25 -0
  120. package/src/resources/beta/vector-stores/vector-stores.ts +318 -0
  121. package/src/resources/chat/chat.ts +23 -0
  122. package/src/resources/chat/completions.ts +2 -21
  123. package/src/resources/chat/index.ts +1 -1
  124. package/src/resources/fine-tuning/jobs/jobs.ts +1 -1
  125. package/src/version.ts +1 -1
  126. package/version.d.ts +1 -1
  127. package/version.js +1 -1
  128. package/version.mjs +1 -1
  129. package/resources/beta/assistants/assistants.d.ts.map +0 -1
  130. package/resources/beta/assistants/assistants.js.map +0 -1
  131. package/resources/beta/assistants/assistants.mjs.map +0 -1
  132. package/resources/beta/assistants/files.d.ts +0 -88
  133. package/resources/beta/assistants/files.d.ts.map +0 -1
  134. package/resources/beta/assistants/files.js +0 -81
  135. package/resources/beta/assistants/files.js.map +0 -1
  136. package/resources/beta/assistants/files.mjs +0 -53
  137. package/resources/beta/assistants/files.mjs.map +0 -1
  138. package/resources/beta/assistants/index.d.ts +0 -3
  139. package/resources/beta/assistants/index.d.ts.map +0 -1
  140. package/resources/beta/assistants/index.js +0 -11
  141. package/resources/beta/assistants/index.js.map +0 -1
  142. package/resources/beta/assistants/index.mjs +0 -4
  143. package/resources/beta/assistants/index.mjs.map +0 -1
  144. package/resources/beta/threads/messages/files.d.ts +0 -60
  145. package/resources/beta/threads/messages/files.d.ts.map +0 -1
  146. package/resources/beta/threads/messages/files.js +0 -60
  147. package/resources/beta/threads/messages/files.js.map +0 -1
  148. package/resources/beta/threads/messages/files.mjs +0 -32
  149. package/resources/beta/threads/messages/files.mjs.map +0 -1
  150. package/resources/beta/threads/messages/index.d.ts +0 -3
  151. package/resources/beta/threads/messages/index.d.ts.map +0 -1
  152. package/resources/beta/threads/messages/index.js +0 -11
  153. package/resources/beta/threads/messages/index.js.map +0 -1
  154. package/resources/beta/threads/messages/index.mjs +0 -4
  155. package/resources/beta/threads/messages/index.mjs.map +0 -1
  156. package/resources/beta/threads/messages/messages.d.ts.map +0 -1
  157. package/resources/beta/threads/messages/messages.js.map +0 -1
  158. package/resources/beta/threads/messages/messages.mjs.map +0 -1
  159. package/src/resources/beta/assistants/files.ts +0 -154
  160. package/src/resources/beta/assistants/index.ts +0 -28
  161. package/src/resources/beta/threads/messages/files.ts +0 -105
  162. package/src/resources/beta/threads/messages/index.ts +0 -30
@@ -3,8 +3,8 @@ import { APIPromise } from 'openai/core';
3
3
  import { APIResource } from 'openai/resource';
4
4
  import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from 'openai/lib/AssistantStream';
5
5
  import * as ThreadsAPI from 'openai/resources/beta/threads/threads';
6
- import * as AssistantsAPI from 'openai/resources/beta/assistants/assistants';
7
- import * as MessagesAPI from 'openai/resources/beta/threads/messages/messages';
6
+ import * as AssistantsAPI from 'openai/resources/beta/assistants';
7
+ import * as MessagesAPI from 'openai/resources/beta/threads/messages';
8
8
  import * as RunsAPI from 'openai/resources/beta/threads/runs/runs';
9
9
  import { Stream } from 'openai/streaming';
10
10
  export declare class Threads extends APIResource {
@@ -82,7 +82,7 @@ export interface AssistantToolChoice {
82
82
  /**
83
83
  * The type of the tool. If type is `function`, the function name must be set
84
84
  */
85
- type: 'function' | 'code_interpreter' | 'retrieval';
85
+ type: 'function' | 'code_interpreter' | 'file_search';
86
86
  function?: AssistantToolChoiceFunction;
87
87
  }
88
88
  export interface AssistantToolChoiceFunction {
@@ -124,6 +124,44 @@ export interface Thread {
124
124
  * The object type, which is always `thread`.
125
125
  */
126
126
  object: 'thread';
127
+ /**
128
+ * A set of resources that are made available to the assistant's tools in this
129
+ * thread. The resources are specific to the type of tool. For example, the
130
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
131
+ * tool requires a list of vector store IDs.
132
+ */
133
+ tool_resources: Thread.ToolResources | null;
134
+ }
135
+ export declare namespace Thread {
136
+ /**
137
+ * A set of resources that are made available to the assistant's tools in this
138
+ * thread. The resources are specific to the type of tool. For example, the
139
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
140
+ * tool requires a list of vector store IDs.
141
+ */
142
+ interface ToolResources {
143
+ code_interpreter?: ToolResources.CodeInterpreter;
144
+ file_search?: ToolResources.FileSearch;
145
+ }
146
+ namespace ToolResources {
147
+ interface CodeInterpreter {
148
+ /**
149
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
150
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
151
+ * associated with the tool.
152
+ */
153
+ file_ids?: Array<string>;
154
+ }
155
+ interface FileSearch {
156
+ /**
157
+ * The
158
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
159
+ * attached to this thread. There can be a maximum of 1 vector store attached to
160
+ * the thread.
161
+ */
162
+ vector_store_ids?: Array<string>;
163
+ }
164
+ }
127
165
  }
128
166
  export interface ThreadDeleted {
129
167
  id: string;
@@ -143,6 +181,13 @@ export interface ThreadCreateParams {
143
181
  * characters long.
144
182
  */
145
183
  metadata?: unknown | null;
184
+ /**
185
+ * A set of resources that are made available to the assistant's tools in this
186
+ * thread. The resources are specific to the type of tool. For example, the
187
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
188
+ * tool requires a list of vector store IDs.
189
+ */
190
+ tool_resources?: ThreadCreateParams.ToolResources | null;
146
191
  }
147
192
  export declare namespace ThreadCreateParams {
148
193
  interface Message {
@@ -160,12 +205,9 @@ export declare namespace ThreadCreateParams {
160
205
  */
161
206
  role: 'user' | 'assistant';
162
207
  /**
163
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
164
- * the message should use. There can be a maximum of 10 files attached to a
165
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
166
- * access and use files.
208
+ * A list of files attached to the message, and the tools they should be added to.
167
209
  */
168
- file_ids?: Array<string>;
210
+ attachments?: Array<Message.Attachment> | null;
169
211
  /**
170
212
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
171
213
  * for storing additional information about the object in a structured format. Keys
@@ -174,6 +216,68 @@ export declare namespace ThreadCreateParams {
174
216
  */
175
217
  metadata?: unknown | null;
176
218
  }
219
+ namespace Message {
220
+ interface Attachment {
221
+ add_to?: Array<'file_search' | 'code_interpreter'>;
222
+ /**
223
+ * The ID of the file to attach to the message.
224
+ */
225
+ file_id?: string;
226
+ }
227
+ }
228
+ /**
229
+ * A set of resources that are made available to the assistant's tools in this
230
+ * thread. The resources are specific to the type of tool. For example, the
231
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
232
+ * tool requires a list of vector store IDs.
233
+ */
234
+ interface ToolResources {
235
+ code_interpreter?: ToolResources.CodeInterpreter;
236
+ file_search?: ToolResources.FileSearch;
237
+ }
238
+ namespace ToolResources {
239
+ interface CodeInterpreter {
240
+ /**
241
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
242
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
243
+ * associated with the tool.
244
+ */
245
+ file_ids?: Array<string>;
246
+ }
247
+ interface FileSearch {
248
+ /**
249
+ * The
250
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
251
+ * attached to this thread. There can be a maximum of 1 vector store attached to
252
+ * the thread.
253
+ */
254
+ vector_store_ids?: Array<string>;
255
+ /**
256
+ * A helper to create a
257
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
258
+ * with file_ids and attach it to this thread. There can be a maximum of 1 vector
259
+ * store attached to the thread.
260
+ */
261
+ vector_stores?: Array<FileSearch.VectorStore>;
262
+ }
263
+ namespace FileSearch {
264
+ interface VectorStore {
265
+ /**
266
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
267
+ * add to the vector store. There can be a maximum of 10000 files in a vector
268
+ * store.
269
+ */
270
+ file_ids?: Array<string>;
271
+ /**
272
+ * Set of 16 key-value pairs that can be attached to a vector store. This can be
273
+ * useful for storing additional information about the vector store in a structured
274
+ * format. Keys can be a maximum of 64 characters long and values can be a maxium
275
+ * of 512 characters long.
276
+ */
277
+ metadata?: unknown;
278
+ }
279
+ }
280
+ }
177
281
  }
178
282
  export interface ThreadUpdateParams {
179
283
  /**
@@ -183,6 +287,44 @@ export interface ThreadUpdateParams {
183
287
  * characters long.
184
288
  */
185
289
  metadata?: unknown | null;
290
+ /**
291
+ * A set of resources that are made available to the assistant's tools in this
292
+ * thread. The resources are specific to the type of tool. For example, the
293
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
294
+ * tool requires a list of vector store IDs.
295
+ */
296
+ tool_resources?: ThreadUpdateParams.ToolResources | null;
297
+ }
298
+ export declare namespace ThreadUpdateParams {
299
+ /**
300
+ * A set of resources that are made available to the assistant's tools in this
301
+ * thread. The resources are specific to the type of tool. For example, the
302
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
303
+ * tool requires a list of vector store IDs.
304
+ */
305
+ interface ToolResources {
306
+ code_interpreter?: ToolResources.CodeInterpreter;
307
+ file_search?: ToolResources.FileSearch;
308
+ }
309
+ namespace ToolResources {
310
+ interface CodeInterpreter {
311
+ /**
312
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
313
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
314
+ * associated with the tool.
315
+ */
316
+ file_ids?: Array<string>;
317
+ }
318
+ interface FileSearch {
319
+ /**
320
+ * The
321
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
322
+ * attached to this thread. There can be a maximum of 1 vector store attached to
323
+ * the thread.
324
+ */
325
+ vector_store_ids?: Array<string>;
326
+ }
327
+ }
186
328
  }
187
329
  export type ThreadCreateAndRunParams = ThreadCreateAndRunParamsNonStreaming | ThreadCreateAndRunParamsStreaming;
188
330
  export interface ThreadCreateAndRunParamsBase {
@@ -201,7 +343,7 @@ export interface ThreadCreateAndRunParamsBase {
201
343
  * The maximum number of completion tokens that may be used over the course of the
202
344
  * run. The run will make a best effort to use only the number of completion tokens
203
345
  * specified, across multiple turns of the run. If the run exceeds the number of
204
- * completion tokens specified, the run will end with status `complete`. See
346
+ * completion tokens specified, the run will end with status `incomplete`. See
205
347
  * `incomplete_details` for more info.
206
348
  */
207
349
  max_completion_tokens?: number | null;
@@ -209,7 +351,7 @@ export interface ThreadCreateAndRunParamsBase {
209
351
  * The maximum number of prompt tokens that may be used over the course of the run.
210
352
  * The run will make a best effort to use only the number of prompt tokens
211
353
  * specified, across multiple turns of the run. If the run exceeds the number of
212
- * prompt tokens specified, the run will end with status `complete`. See
354
+ * prompt tokens specified, the run will end with status `incomplete`. See
213
355
  * `incomplete_details` for more info.
214
356
  */
215
357
  max_prompt_tokens?: number | null;
@@ -269,11 +411,24 @@ export interface ThreadCreateAndRunParamsBase {
269
411
  * call that tool.
270
412
  */
271
413
  tool_choice?: AssistantToolChoiceOption | null;
414
+ /**
415
+ * A set of resources that are used by the assistant's tools. The resources are
416
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
417
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
418
+ * IDs.
419
+ */
420
+ tool_resources?: ThreadCreateAndRunParams.ToolResources | null;
272
421
  /**
273
422
  * Override the tools the assistant can use for this run. This is useful for
274
423
  * modifying the behavior on a per-run basis.
275
424
  */
276
- tools?: Array<AssistantsAPI.CodeInterpreterTool | AssistantsAPI.RetrievalTool | AssistantsAPI.FunctionTool> | null;
425
+ tools?: Array<AssistantsAPI.CodeInterpreterTool | AssistantsAPI.FileSearchTool | AssistantsAPI.FunctionTool> | null;
426
+ /**
427
+ * An alternative to sampling with temperature, called nucleus sampling, where the
428
+ * model considers the results of the tokens with top_p probability mass. So 0.1
429
+ * means only the tokens comprising the top 10% probability mass are considered.
430
+ */
431
+ top_p?: number | null;
277
432
  truncation_strategy?: ThreadCreateAndRunParams.TruncationStrategy | null;
278
433
  }
279
434
  export declare namespace ThreadCreateAndRunParams {
@@ -293,6 +448,13 @@ export declare namespace ThreadCreateAndRunParams {
293
448
  * characters long.
294
449
  */
295
450
  metadata?: unknown | null;
451
+ /**
452
+ * A set of resources that are made available to the assistant's tools in this
453
+ * thread. The resources are specific to the type of tool. For example, the
454
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
455
+ * tool requires a list of vector store IDs.
456
+ */
457
+ tool_resources?: Thread.ToolResources | null;
296
458
  }
297
459
  namespace Thread {
298
460
  interface Message {
@@ -310,12 +472,9 @@ export declare namespace ThreadCreateAndRunParams {
310
472
  */
311
473
  role: 'user' | 'assistant';
312
474
  /**
313
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
314
- * the message should use. There can be a maximum of 10 files attached to a
315
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
316
- * access and use files.
475
+ * A list of files attached to the message, and the tools they should be added to.
317
476
  */
318
- file_ids?: Array<string>;
477
+ attachments?: Array<Message.Attachment> | null;
319
478
  /**
320
479
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
321
480
  * for storing additional information about the object in a structured format. Keys
@@ -324,6 +483,97 @@ export declare namespace ThreadCreateAndRunParams {
324
483
  */
325
484
  metadata?: unknown | null;
326
485
  }
486
+ namespace Message {
487
+ interface Attachment {
488
+ add_to?: Array<'file_search' | 'code_interpreter'>;
489
+ /**
490
+ * The ID of the file to attach to the message.
491
+ */
492
+ file_id?: string;
493
+ }
494
+ }
495
+ /**
496
+ * A set of resources that are made available to the assistant's tools in this
497
+ * thread. The resources are specific to the type of tool. For example, the
498
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
499
+ * tool requires a list of vector store IDs.
500
+ */
501
+ interface ToolResources {
502
+ code_interpreter?: ToolResources.CodeInterpreter;
503
+ file_search?: ToolResources.FileSearch;
504
+ }
505
+ namespace ToolResources {
506
+ interface CodeInterpreter {
507
+ /**
508
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
509
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
510
+ * associated with the tool.
511
+ */
512
+ file_ids?: Array<string>;
513
+ }
514
+ interface FileSearch {
515
+ /**
516
+ * The
517
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
518
+ * attached to this thread. There can be a maximum of 1 vector store attached to
519
+ * the thread.
520
+ */
521
+ vector_store_ids?: Array<string>;
522
+ /**
523
+ * A helper to create a
524
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
525
+ * with file_ids and attach it to this thread. There can be a maximum of 1 vector
526
+ * store attached to the thread.
527
+ */
528
+ vector_stores?: Array<FileSearch.VectorStore>;
529
+ }
530
+ namespace FileSearch {
531
+ interface VectorStore {
532
+ /**
533
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
534
+ * add to the vector store. There can be a maximum of 10000 files in a vector
535
+ * store.
536
+ */
537
+ file_ids?: Array<string>;
538
+ /**
539
+ * Set of 16 key-value pairs that can be attached to a vector store. This can be
540
+ * useful for storing additional information about the vector store in a structured
541
+ * format. Keys can be a maximum of 64 characters long and values can be a maxium
542
+ * of 512 characters long.
543
+ */
544
+ metadata?: unknown;
545
+ }
546
+ }
547
+ }
548
+ }
549
+ /**
550
+ * A set of resources that are used by the assistant's tools. The resources are
551
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
552
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
553
+ * IDs.
554
+ */
555
+ interface ToolResources {
556
+ code_interpreter?: ToolResources.CodeInterpreter;
557
+ file_search?: ToolResources.FileSearch;
558
+ }
559
+ namespace ToolResources {
560
+ interface CodeInterpreter {
561
+ /**
562
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
563
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
564
+ * associated with the tool.
565
+ */
566
+ file_ids?: Array<string>;
567
+ }
568
+ interface FileSearch {
569
+ /**
570
+ * The ID of the
571
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
572
+ * attached to this assistant. There can be a maximum of 1 vector store attached to
573
+ * the assistant.
574
+ */
575
+ vector_store_ids?: Array<string>;
576
+ }
327
577
  }
328
578
  interface TruncationStrategy {
329
579
  /**
@@ -374,7 +624,7 @@ export interface ThreadCreateAndRunPollParams {
374
624
  * The maximum number of completion tokens that may be used over the course of the
375
625
  * run. The run will make a best effort to use only the number of completion tokens
376
626
  * specified, across multiple turns of the run. If the run exceeds the number of
377
- * completion tokens specified, the run will end with status `complete`. See
627
+ * completion tokens specified, the run will end with status `incomplete`. See
378
628
  * `incomplete_details` for more info.
379
629
  */
380
630
  max_completion_tokens?: number | null;
@@ -382,7 +632,7 @@ export interface ThreadCreateAndRunPollParams {
382
632
  * The maximum number of prompt tokens that may be used over the course of the run.
383
633
  * The run will make a best effort to use only the number of prompt tokens
384
634
  * specified, across multiple turns of the run. If the run exceeds the number of
385
- * prompt tokens specified, the run will end with status `complete`. See
635
+ * prompt tokens specified, the run will end with status `incomplete`. See
386
636
  * `incomplete_details` for more info.
387
637
  */
388
638
  max_prompt_tokens?: number | null;
@@ -436,11 +686,24 @@ export interface ThreadCreateAndRunPollParams {
436
686
  * call that tool.
437
687
  */
438
688
  tool_choice?: AssistantToolChoiceOption | null;
689
+ /**
690
+ * A set of resources that are used by the assistant's tools. The resources are
691
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
692
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
693
+ * IDs.
694
+ */
695
+ tool_resources?: ThreadCreateAndRunPollParams.ToolResources | null;
439
696
  /**
440
697
  * Override the tools the assistant can use for this run. This is useful for
441
698
  * modifying the behavior on a per-run basis.
442
699
  */
443
- tools?: Array<AssistantsAPI.CodeInterpreterTool | AssistantsAPI.RetrievalTool | AssistantsAPI.FunctionTool> | null;
700
+ tools?: Array<AssistantsAPI.CodeInterpreterTool | AssistantsAPI.FileSearchTool | AssistantsAPI.FunctionTool> | null;
701
+ /**
702
+ * An alternative to sampling with temperature, called nucleus sampling, where the
703
+ * model considers the results of the tokens with top_p probability mass. So 0.1
704
+ * means only the tokens comprising the top 10% probability mass are considered.
705
+ */
706
+ top_p?: number | null;
444
707
  truncation_strategy?: ThreadCreateAndRunPollParams.TruncationStrategy | null;
445
708
  }
446
709
  export declare namespace ThreadCreateAndRunPollParams {
@@ -460,6 +723,13 @@ export declare namespace ThreadCreateAndRunPollParams {
460
723
  * characters long.
461
724
  */
462
725
  metadata?: unknown | null;
726
+ /**
727
+ * A set of resources that are made available to the assistant's tools in this
728
+ * thread. The resources are specific to the type of tool. For example, the
729
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
730
+ * tool requires a list of vector store IDs.
731
+ */
732
+ tool_resources?: Thread.ToolResources | null;
463
733
  }
464
734
  namespace Thread {
465
735
  interface Message {
@@ -477,12 +747,9 @@ export declare namespace ThreadCreateAndRunPollParams {
477
747
  */
478
748
  role: 'user' | 'assistant';
479
749
  /**
480
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
481
- * the message should use. There can be a maximum of 10 files attached to a
482
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
483
- * access and use files.
750
+ * A list of files attached to the message, and the tools they should be added to.
484
751
  */
485
- file_ids?: Array<string>;
752
+ attachments?: Array<Message.Attachment> | null;
486
753
  /**
487
754
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
488
755
  * for storing additional information about the object in a structured format. Keys
@@ -491,6 +758,97 @@ export declare namespace ThreadCreateAndRunPollParams {
491
758
  */
492
759
  metadata?: unknown | null;
493
760
  }
761
+ namespace Message {
762
+ interface Attachment {
763
+ add_to?: Array<'file_search' | 'code_interpreter'>;
764
+ /**
765
+ * The ID of the file to attach to the message.
766
+ */
767
+ file_id?: string;
768
+ }
769
+ }
770
+ /**
771
+ * A set of resources that are made available to the assistant's tools in this
772
+ * thread. The resources are specific to the type of tool. For example, the
773
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
774
+ * tool requires a list of vector store IDs.
775
+ */
776
+ interface ToolResources {
777
+ code_interpreter?: ToolResources.CodeInterpreter;
778
+ file_search?: ToolResources.FileSearch;
779
+ }
780
+ namespace ToolResources {
781
+ interface CodeInterpreter {
782
+ /**
783
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
784
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
785
+ * associated with the tool.
786
+ */
787
+ file_ids?: Array<string>;
788
+ }
789
+ interface FileSearch {
790
+ /**
791
+ * The
792
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
793
+ * attached to this thread. There can be a maximum of 1 vector store attached to
794
+ * the thread.
795
+ */
796
+ vector_store_ids?: Array<string>;
797
+ /**
798
+ * A helper to create a
799
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
800
+ * with file_ids and attach it to this thread. There can be a maximum of 1 vector
801
+ * store attached to the thread.
802
+ */
803
+ vector_stores?: Array<FileSearch.VectorStore>;
804
+ }
805
+ namespace FileSearch {
806
+ interface VectorStore {
807
+ /**
808
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
809
+ * add to the vector store. There can be a maximum of 10000 files in a vector
810
+ * store.
811
+ */
812
+ file_ids?: Array<string>;
813
+ /**
814
+ * Set of 16 key-value pairs that can be attached to a vector store. This can be
815
+ * useful for storing additional information about the vector store in a structured
816
+ * format. Keys can be a maximum of 64 characters long and values can be a maxium
817
+ * of 512 characters long.
818
+ */
819
+ metadata?: unknown;
820
+ }
821
+ }
822
+ }
823
+ }
824
+ /**
825
+ * A set of resources that are used by the assistant's tools. The resources are
826
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
827
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
828
+ * IDs.
829
+ */
830
+ interface ToolResources {
831
+ code_interpreter?: ToolResources.CodeInterpreter;
832
+ file_search?: ToolResources.FileSearch;
833
+ }
834
+ namespace ToolResources {
835
+ interface CodeInterpreter {
836
+ /**
837
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
838
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
839
+ * associated with the tool.
840
+ */
841
+ file_ids?: Array<string>;
842
+ }
843
+ interface FileSearch {
844
+ /**
845
+ * The ID of the
846
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
847
+ * attached to this assistant. There can be a maximum of 1 vector store attached to
848
+ * the assistant.
849
+ */
850
+ vector_store_ids?: Array<string>;
851
+ }
494
852
  }
495
853
  interface TruncationStrategy {
496
854
  /**
@@ -523,7 +881,7 @@ export interface ThreadCreateAndRunStreamParams {
523
881
  * The maximum number of completion tokens that may be used over the course of the
524
882
  * run. The run will make a best effort to use only the number of completion tokens
525
883
  * specified, across multiple turns of the run. If the run exceeds the number of
526
- * completion tokens specified, the run will end with status `complete`. See
884
+ * completion tokens specified, the run will end with status `incomplete`. See
527
885
  * `incomplete_details` for more info.
528
886
  */
529
887
  max_completion_tokens?: number | null;
@@ -531,7 +889,7 @@ export interface ThreadCreateAndRunStreamParams {
531
889
  * The maximum number of prompt tokens that may be used over the course of the run.
532
890
  * The run will make a best effort to use only the number of prompt tokens
533
891
  * specified, across multiple turns of the run. If the run exceeds the number of
534
- * prompt tokens specified, the run will end with status `complete`. See
892
+ * prompt tokens specified, the run will end with status `incomplete`. See
535
893
  * `incomplete_details` for more info.
536
894
  */
537
895
  max_prompt_tokens?: number | null;
@@ -585,11 +943,24 @@ export interface ThreadCreateAndRunStreamParams {
585
943
  * call that tool.
586
944
  */
587
945
  tool_choice?: AssistantToolChoiceOption | null;
946
+ /**
947
+ * A set of resources that are used by the assistant's tools. The resources are
948
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
949
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
950
+ * IDs.
951
+ */
952
+ tool_resources?: ThreadCreateAndRunStreamParams.ToolResources | null;
588
953
  /**
589
954
  * Override the tools the assistant can use for this run. This is useful for
590
955
  * modifying the behavior on a per-run basis.
591
956
  */
592
- tools?: Array<AssistantsAPI.CodeInterpreterTool | AssistantsAPI.RetrievalTool | AssistantsAPI.FunctionTool> | null;
957
+ tools?: Array<AssistantsAPI.CodeInterpreterTool | AssistantsAPI.FileSearchTool | AssistantsAPI.FunctionTool> | null;
958
+ /**
959
+ * An alternative to sampling with temperature, called nucleus sampling, where the
960
+ * model considers the results of the tokens with top_p probability mass. So 0.1
961
+ * means only the tokens comprising the top 10% probability mass are considered.
962
+ */
963
+ top_p?: number | null;
593
964
  truncation_strategy?: ThreadCreateAndRunStreamParams.TruncationStrategy | null;
594
965
  }
595
966
  export declare namespace ThreadCreateAndRunStreamParams {
@@ -609,6 +980,13 @@ export declare namespace ThreadCreateAndRunStreamParams {
609
980
  * characters long.
610
981
  */
611
982
  metadata?: unknown | null;
983
+ /**
984
+ * A set of resources that are made available to the assistant's tools in this
985
+ * thread. The resources are specific to the type of tool. For example, the
986
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
987
+ * tool requires a list of vector store IDs.
988
+ */
989
+ tool_resources?: Thread.ToolResources | null;
612
990
  }
613
991
  namespace Thread {
614
992
  interface Message {
@@ -626,12 +1004,9 @@ export declare namespace ThreadCreateAndRunStreamParams {
626
1004
  */
627
1005
  role: 'user' | 'assistant';
628
1006
  /**
629
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
630
- * the message should use. There can be a maximum of 10 files attached to a
631
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
632
- * access and use files.
1007
+ * A list of files attached to the message, and the tools they should be added to.
633
1008
  */
634
- file_ids?: Array<string>;
1009
+ attachments?: Array<Message.Attachment> | null;
635
1010
  /**
636
1011
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
637
1012
  * for storing additional information about the object in a structured format. Keys
@@ -640,6 +1015,97 @@ export declare namespace ThreadCreateAndRunStreamParams {
640
1015
  */
641
1016
  metadata?: unknown | null;
642
1017
  }
1018
+ namespace Message {
1019
+ interface Attachment {
1020
+ add_to?: Array<'file_search' | 'code_interpreter'>;
1021
+ /**
1022
+ * The ID of the file to attach to the message.
1023
+ */
1024
+ file_id?: string;
1025
+ }
1026
+ }
1027
+ /**
1028
+ * A set of resources that are made available to the assistant's tools in this
1029
+ * thread. The resources are specific to the type of tool. For example, the
1030
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
1031
+ * tool requires a list of vector store IDs.
1032
+ */
1033
+ interface ToolResources {
1034
+ code_interpreter?: ToolResources.CodeInterpreter;
1035
+ file_search?: ToolResources.FileSearch;
1036
+ }
1037
+ namespace ToolResources {
1038
+ interface CodeInterpreter {
1039
+ /**
1040
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
1041
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
1042
+ * associated with the tool.
1043
+ */
1044
+ file_ids?: Array<string>;
1045
+ }
1046
+ interface FileSearch {
1047
+ /**
1048
+ * The
1049
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1050
+ * attached to this thread. There can be a maximum of 1 vector store attached to
1051
+ * the thread.
1052
+ */
1053
+ vector_store_ids?: Array<string>;
1054
+ /**
1055
+ * A helper to create a
1056
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1057
+ * with file_ids and attach it to this thread. There can be a maximum of 1 vector
1058
+ * store attached to the thread.
1059
+ */
1060
+ vector_stores?: Array<FileSearch.VectorStore>;
1061
+ }
1062
+ namespace FileSearch {
1063
+ interface VectorStore {
1064
+ /**
1065
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
1066
+ * add to the vector store. There can be a maximum of 10000 files in a vector
1067
+ * store.
1068
+ */
1069
+ file_ids?: Array<string>;
1070
+ /**
1071
+ * Set of 16 key-value pairs that can be attached to a vector store. This can be
1072
+ * useful for storing additional information about the vector store in a structured
1073
+ * format. Keys can be a maximum of 64 characters long and values can be a maxium
1074
+ * of 512 characters long.
1075
+ */
1076
+ metadata?: unknown;
1077
+ }
1078
+ }
1079
+ }
1080
+ }
1081
+ /**
1082
+ * A set of resources that are used by the assistant's tools. The resources are
1083
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
1084
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
1085
+ * IDs.
1086
+ */
1087
+ interface ToolResources {
1088
+ code_interpreter?: ToolResources.CodeInterpreter;
1089
+ file_search?: ToolResources.FileSearch;
1090
+ }
1091
+ namespace ToolResources {
1092
+ interface CodeInterpreter {
1093
+ /**
1094
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
1095
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
1096
+ * associated with the tool.
1097
+ */
1098
+ file_ids?: Array<string>;
1099
+ }
1100
+ interface FileSearch {
1101
+ /**
1102
+ * The ID of the
1103
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1104
+ * attached to this assistant. There can be a maximum of 1 vector store attached to
1105
+ * the assistant.
1106
+ */
1107
+ vector_store_ids?: Array<string>;
1108
+ }
643
1109
  }
644
1110
  interface TruncationStrategy {
645
1111
  /**