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
@@ -6,8 +6,8 @@ import { APIResource } from "../../../resource";
6
6
  import { isRequestOptions } from "../../../core";
7
7
  import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from "../../../lib/AssistantStream";
8
8
  import * as ThreadsAPI from "./threads";
9
- import * as AssistantsAPI from "../assistants/assistants";
10
- import * as MessagesAPI from "./messages/messages";
9
+ import * as AssistantsAPI from "../assistants";
10
+ import * as MessagesAPI from "./messages";
11
11
  import * as RunsAPI from "./runs/runs";
12
12
  import { Stream } from "../../../streaming";
13
13
 
@@ -30,7 +30,7 @@ export class Threads extends APIResource {
30
30
  return this._client.post('/threads', {
31
31
  body,
32
32
  ...options,
33
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
33
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
34
34
  });
35
35
  }
36
36
 
@@ -40,7 +40,7 @@ export class Threads extends APIResource {
40
40
  retrieve(threadId: string, options?: Core.RequestOptions): Core.APIPromise<Thread> {
41
41
  return this._client.get(`/threads/${threadId}`, {
42
42
  ...options,
43
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
43
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
44
44
  });
45
45
  }
46
46
 
@@ -51,7 +51,7 @@ export class Threads extends APIResource {
51
51
  return this._client.post(`/threads/${threadId}`, {
52
52
  body,
53
53
  ...options,
54
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
54
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
55
55
  });
56
56
  }
57
57
 
@@ -61,7 +61,7 @@ export class Threads extends APIResource {
61
61
  del(threadId: string, options?: Core.RequestOptions): Core.APIPromise<ThreadDeleted> {
62
62
  return this._client.delete(`/threads/${threadId}`, {
63
63
  ...options,
64
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
64
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
65
65
  });
66
66
  }
67
67
 
@@ -87,7 +87,7 @@ export class Threads extends APIResource {
87
87
  return this._client.post('/threads/runs', {
88
88
  body,
89
89
  ...options,
90
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
90
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
91
91
  stream: body.stream ?? false,
92
92
  }) as APIPromise<RunsAPI.Run> | APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>;
93
93
  }
@@ -154,7 +154,7 @@ export interface AssistantToolChoice {
154
154
  /**
155
155
  * The type of the tool. If type is `function`, the function name must be set
156
156
  */
157
- type: 'function' | 'code_interpreter' | 'retrieval';
157
+ type: 'function' | 'code_interpreter' | 'file_search';
158
158
 
159
159
  function?: AssistantToolChoiceFunction;
160
160
  }
@@ -203,6 +203,49 @@ export interface Thread {
203
203
  * The object type, which is always `thread`.
204
204
  */
205
205
  object: 'thread';
206
+
207
+ /**
208
+ * A set of resources that are made available to the assistant's tools in this
209
+ * thread. The resources are specific to the type of tool. For example, the
210
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
211
+ * tool requires a list of vector store IDs.
212
+ */
213
+ tool_resources: Thread.ToolResources | null;
214
+ }
215
+
216
+ export namespace Thread {
217
+ /**
218
+ * A set of resources that are made available to the assistant's tools in this
219
+ * thread. The resources are specific to the type of tool. For example, the
220
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
221
+ * tool requires a list of vector store IDs.
222
+ */
223
+ export interface ToolResources {
224
+ code_interpreter?: ToolResources.CodeInterpreter;
225
+
226
+ file_search?: ToolResources.FileSearch;
227
+ }
228
+
229
+ export namespace ToolResources {
230
+ export interface CodeInterpreter {
231
+ /**
232
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
233
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
234
+ * associated with the tool.
235
+ */
236
+ file_ids?: Array<string>;
237
+ }
238
+
239
+ export interface FileSearch {
240
+ /**
241
+ * The
242
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
243
+ * attached to this thread. There can be a maximum of 1 vector store attached to
244
+ * the thread.
245
+ */
246
+ vector_store_ids?: Array<string>;
247
+ }
248
+ }
206
249
  }
207
250
 
208
251
  export interface ThreadDeleted {
@@ -227,6 +270,14 @@ export interface ThreadCreateParams {
227
270
  * characters long.
228
271
  */
229
272
  metadata?: unknown | null;
273
+
274
+ /**
275
+ * A set of resources that are made available to the assistant's tools in this
276
+ * thread. The resources are specific to the type of tool. For example, the
277
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
278
+ * tool requires a list of vector store IDs.
279
+ */
280
+ tool_resources?: ThreadCreateParams.ToolResources | null;
230
281
  }
231
282
 
232
283
  export namespace ThreadCreateParams {
@@ -247,12 +298,9 @@ export namespace ThreadCreateParams {
247
298
  role: 'user' | 'assistant';
248
299
 
249
300
  /**
250
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
251
- * the message should use. There can be a maximum of 10 files attached to a
252
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
253
- * access and use files.
301
+ * A list of files attached to the message, and the tools they should be added to.
254
302
  */
255
- file_ids?: Array<string>;
303
+ attachments?: Array<Message.Attachment> | null;
256
304
 
257
305
  /**
258
306
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -262,6 +310,77 @@ export namespace ThreadCreateParams {
262
310
  */
263
311
  metadata?: unknown | null;
264
312
  }
313
+
314
+ export namespace Message {
315
+ export interface Attachment {
316
+ add_to?: Array<'file_search' | 'code_interpreter'>;
317
+
318
+ /**
319
+ * The ID of the file to attach to the message.
320
+ */
321
+ file_id?: string;
322
+ }
323
+ }
324
+
325
+ /**
326
+ * A set of resources that are made available to the assistant's tools in this
327
+ * thread. The resources are specific to the type of tool. For example, the
328
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
329
+ * tool requires a list of vector store IDs.
330
+ */
331
+ export interface ToolResources {
332
+ code_interpreter?: ToolResources.CodeInterpreter;
333
+
334
+ file_search?: ToolResources.FileSearch;
335
+ }
336
+
337
+ export namespace ToolResources {
338
+ export interface CodeInterpreter {
339
+ /**
340
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
341
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
342
+ * associated with the tool.
343
+ */
344
+ file_ids?: Array<string>;
345
+ }
346
+
347
+ export interface FileSearch {
348
+ /**
349
+ * The
350
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
351
+ * attached to this thread. There can be a maximum of 1 vector store attached to
352
+ * the thread.
353
+ */
354
+ vector_store_ids?: Array<string>;
355
+
356
+ /**
357
+ * A helper to create a
358
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
359
+ * with file_ids and attach it to this thread. There can be a maximum of 1 vector
360
+ * store attached to the thread.
361
+ */
362
+ vector_stores?: Array<FileSearch.VectorStore>;
363
+ }
364
+
365
+ export namespace FileSearch {
366
+ export interface VectorStore {
367
+ /**
368
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
369
+ * add to the vector store. There can be a maximum of 10000 files in a vector
370
+ * store.
371
+ */
372
+ file_ids?: Array<string>;
373
+
374
+ /**
375
+ * Set of 16 key-value pairs that can be attached to a vector store. This can be
376
+ * useful for storing additional information about the vector store in a structured
377
+ * format. Keys can be a maximum of 64 characters long and values can be a maxium
378
+ * of 512 characters long.
379
+ */
380
+ metadata?: unknown;
381
+ }
382
+ }
383
+ }
265
384
  }
266
385
 
267
386
  export interface ThreadUpdateParams {
@@ -272,6 +391,49 @@ export interface ThreadUpdateParams {
272
391
  * characters long.
273
392
  */
274
393
  metadata?: unknown | null;
394
+
395
+ /**
396
+ * A set of resources that are made available to the assistant's tools in this
397
+ * thread. The resources are specific to the type of tool. For example, the
398
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
399
+ * tool requires a list of vector store IDs.
400
+ */
401
+ tool_resources?: ThreadUpdateParams.ToolResources | null;
402
+ }
403
+
404
+ export namespace ThreadUpdateParams {
405
+ /**
406
+ * A set of resources that are made available to the assistant's tools in this
407
+ * thread. The resources are specific to the type of tool. For example, the
408
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
409
+ * tool requires a list of vector store IDs.
410
+ */
411
+ export interface ToolResources {
412
+ code_interpreter?: ToolResources.CodeInterpreter;
413
+
414
+ file_search?: ToolResources.FileSearch;
415
+ }
416
+
417
+ export namespace ToolResources {
418
+ export interface CodeInterpreter {
419
+ /**
420
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
421
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
422
+ * associated with the tool.
423
+ */
424
+ file_ids?: Array<string>;
425
+ }
426
+
427
+ export interface FileSearch {
428
+ /**
429
+ * The
430
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
431
+ * attached to this thread. There can be a maximum of 1 vector store attached to
432
+ * the thread.
433
+ */
434
+ vector_store_ids?: Array<string>;
435
+ }
436
+ }
275
437
  }
276
438
 
277
439
  export type ThreadCreateAndRunParams =
@@ -296,7 +458,7 @@ export interface ThreadCreateAndRunParamsBase {
296
458
  * The maximum number of completion tokens that may be used over the course of the
297
459
  * run. The run will make a best effort to use only the number of completion tokens
298
460
  * specified, across multiple turns of the run. If the run exceeds the number of
299
- * completion tokens specified, the run will end with status `complete`. See
461
+ * completion tokens specified, the run will end with status `incomplete`. See
300
462
  * `incomplete_details` for more info.
301
463
  */
302
464
  max_completion_tokens?: number | null;
@@ -305,7 +467,7 @@ export interface ThreadCreateAndRunParamsBase {
305
467
  * The maximum number of prompt tokens that may be used over the course of the run.
306
468
  * The run will make a best effort to use only the number of prompt tokens
307
469
  * specified, across multiple turns of the run. If the run exceeds the number of
308
- * prompt tokens specified, the run will end with status `complete`. See
470
+ * prompt tokens specified, the run will end with status `incomplete`. See
309
471
  * `incomplete_details` for more info.
310
472
  */
311
473
  max_prompt_tokens?: number | null;
@@ -393,14 +555,29 @@ export interface ThreadCreateAndRunParamsBase {
393
555
  */
394
556
  tool_choice?: AssistantToolChoiceOption | null;
395
557
 
558
+ /**
559
+ * A set of resources that are used by the assistant's tools. The resources are
560
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
561
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
562
+ * IDs.
563
+ */
564
+ tool_resources?: ThreadCreateAndRunParams.ToolResources | null;
565
+
396
566
  /**
397
567
  * Override the tools the assistant can use for this run. This is useful for
398
568
  * modifying the behavior on a per-run basis.
399
569
  */
400
570
  tools?: Array<
401
- AssistantsAPI.CodeInterpreterTool | AssistantsAPI.RetrievalTool | AssistantsAPI.FunctionTool
571
+ AssistantsAPI.CodeInterpreterTool | AssistantsAPI.FileSearchTool | AssistantsAPI.FunctionTool
402
572
  > | null;
403
573
 
574
+ /**
575
+ * An alternative to sampling with temperature, called nucleus sampling, where the
576
+ * model considers the results of the tokens with top_p probability mass. So 0.1
577
+ * means only the tokens comprising the top 10% probability mass are considered.
578
+ */
579
+ top_p?: number | null;
580
+
404
581
  truncation_strategy?: ThreadCreateAndRunParams.TruncationStrategy | null;
405
582
  }
406
583
 
@@ -422,6 +599,14 @@ export namespace ThreadCreateAndRunParams {
422
599
  * characters long.
423
600
  */
424
601
  metadata?: unknown | null;
602
+
603
+ /**
604
+ * A set of resources that are made available to the assistant's tools in this
605
+ * thread. The resources are specific to the type of tool. For example, the
606
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
607
+ * tool requires a list of vector store IDs.
608
+ */
609
+ tool_resources?: Thread.ToolResources | null;
425
610
  }
426
611
 
427
612
  export namespace Thread {
@@ -442,12 +627,9 @@ export namespace ThreadCreateAndRunParams {
442
627
  role: 'user' | 'assistant';
443
628
 
444
629
  /**
445
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
446
- * the message should use. There can be a maximum of 10 files attached to a
447
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
448
- * access and use files.
630
+ * A list of files attached to the message, and the tools they should be added to.
449
631
  */
450
- file_ids?: Array<string>;
632
+ attachments?: Array<Message.Attachment> | null;
451
633
 
452
634
  /**
453
635
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -457,6 +639,110 @@ export namespace ThreadCreateAndRunParams {
457
639
  */
458
640
  metadata?: unknown | null;
459
641
  }
642
+
643
+ export namespace Message {
644
+ export interface Attachment {
645
+ add_to?: Array<'file_search' | 'code_interpreter'>;
646
+
647
+ /**
648
+ * The ID of the file to attach to the message.
649
+ */
650
+ file_id?: string;
651
+ }
652
+ }
653
+
654
+ /**
655
+ * A set of resources that are made available to the assistant's tools in this
656
+ * thread. The resources are specific to the type of tool. For example, the
657
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
658
+ * tool requires a list of vector store IDs.
659
+ */
660
+ export interface ToolResources {
661
+ code_interpreter?: ToolResources.CodeInterpreter;
662
+
663
+ file_search?: ToolResources.FileSearch;
664
+ }
665
+
666
+ export namespace ToolResources {
667
+ export interface CodeInterpreter {
668
+ /**
669
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
670
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
671
+ * associated with the tool.
672
+ */
673
+ file_ids?: Array<string>;
674
+ }
675
+
676
+ export interface FileSearch {
677
+ /**
678
+ * The
679
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
680
+ * attached to this thread. There can be a maximum of 1 vector store attached to
681
+ * the thread.
682
+ */
683
+ vector_store_ids?: Array<string>;
684
+
685
+ /**
686
+ * A helper to create a
687
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
688
+ * with file_ids and attach it to this thread. There can be a maximum of 1 vector
689
+ * store attached to the thread.
690
+ */
691
+ vector_stores?: Array<FileSearch.VectorStore>;
692
+ }
693
+
694
+ export namespace FileSearch {
695
+ export interface VectorStore {
696
+ /**
697
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
698
+ * add to the vector store. There can be a maximum of 10000 files in a vector
699
+ * store.
700
+ */
701
+ file_ids?: Array<string>;
702
+
703
+ /**
704
+ * Set of 16 key-value pairs that can be attached to a vector store. This can be
705
+ * useful for storing additional information about the vector store in a structured
706
+ * format. Keys can be a maximum of 64 characters long and values can be a maxium
707
+ * of 512 characters long.
708
+ */
709
+ metadata?: unknown;
710
+ }
711
+ }
712
+ }
713
+ }
714
+
715
+ /**
716
+ * A set of resources that are used by the assistant's tools. The resources are
717
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
718
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
719
+ * IDs.
720
+ */
721
+ export interface ToolResources {
722
+ code_interpreter?: ToolResources.CodeInterpreter;
723
+
724
+ file_search?: ToolResources.FileSearch;
725
+ }
726
+
727
+ export namespace ToolResources {
728
+ export interface CodeInterpreter {
729
+ /**
730
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
731
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
732
+ * associated with the tool.
733
+ */
734
+ file_ids?: Array<string>;
735
+ }
736
+
737
+ export interface FileSearch {
738
+ /**
739
+ * The ID of the
740
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
741
+ * attached to this assistant. There can be a maximum of 1 vector store attached to
742
+ * the assistant.
743
+ */
744
+ vector_store_ids?: Array<string>;
745
+ }
460
746
  }
461
747
 
462
748
  export interface TruncationStrategy {
@@ -515,7 +801,7 @@ export interface ThreadCreateAndRunPollParams {
515
801
  * The maximum number of completion tokens that may be used over the course of the
516
802
  * run. The run will make a best effort to use only the number of completion tokens
517
803
  * specified, across multiple turns of the run. If the run exceeds the number of
518
- * completion tokens specified, the run will end with status `complete`. See
804
+ * completion tokens specified, the run will end with status `incomplete`. See
519
805
  * `incomplete_details` for more info.
520
806
  */
521
807
  max_completion_tokens?: number | null;
@@ -524,7 +810,7 @@ export interface ThreadCreateAndRunPollParams {
524
810
  * The maximum number of prompt tokens that may be used over the course of the run.
525
811
  * The run will make a best effort to use only the number of prompt tokens
526
812
  * specified, across multiple turns of the run. If the run exceeds the number of
527
- * prompt tokens specified, the run will end with status `complete`. See
813
+ * prompt tokens specified, the run will end with status `incomplete`. See
528
814
  * `incomplete_details` for more info.
529
815
  */
530
816
  max_prompt_tokens?: number | null;
@@ -605,14 +891,29 @@ export interface ThreadCreateAndRunPollParams {
605
891
  */
606
892
  tool_choice?: AssistantToolChoiceOption | null;
607
893
 
894
+ /**
895
+ * A set of resources that are used by the assistant's tools. The resources are
896
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
897
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
898
+ * IDs.
899
+ */
900
+ tool_resources?: ThreadCreateAndRunPollParams.ToolResources | null;
901
+
608
902
  /**
609
903
  * Override the tools the assistant can use for this run. This is useful for
610
904
  * modifying the behavior on a per-run basis.
611
905
  */
612
906
  tools?: Array<
613
- AssistantsAPI.CodeInterpreterTool | AssistantsAPI.RetrievalTool | AssistantsAPI.FunctionTool
907
+ AssistantsAPI.CodeInterpreterTool | AssistantsAPI.FileSearchTool | AssistantsAPI.FunctionTool
614
908
  > | null;
615
909
 
910
+ /**
911
+ * An alternative to sampling with temperature, called nucleus sampling, where the
912
+ * model considers the results of the tokens with top_p probability mass. So 0.1
913
+ * means only the tokens comprising the top 10% probability mass are considered.
914
+ */
915
+ top_p?: number | null;
916
+
616
917
  truncation_strategy?: ThreadCreateAndRunPollParams.TruncationStrategy | null;
617
918
  }
618
919
 
@@ -634,6 +935,14 @@ export namespace ThreadCreateAndRunPollParams {
634
935
  * characters long.
635
936
  */
636
937
  metadata?: unknown | null;
938
+
939
+ /**
940
+ * A set of resources that are made available to the assistant's tools in this
941
+ * thread. The resources are specific to the type of tool. For example, the
942
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
943
+ * tool requires a list of vector store IDs.
944
+ */
945
+ tool_resources?: Thread.ToolResources | null;
637
946
  }
638
947
 
639
948
  export namespace Thread {
@@ -654,12 +963,9 @@ export namespace ThreadCreateAndRunPollParams {
654
963
  role: 'user' | 'assistant';
655
964
 
656
965
  /**
657
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
658
- * the message should use. There can be a maximum of 10 files attached to a
659
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
660
- * access and use files.
966
+ * A list of files attached to the message, and the tools they should be added to.
661
967
  */
662
- file_ids?: Array<string>;
968
+ attachments?: Array<Message.Attachment> | null;
663
969
 
664
970
  /**
665
971
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -669,6 +975,110 @@ export namespace ThreadCreateAndRunPollParams {
669
975
  */
670
976
  metadata?: unknown | null;
671
977
  }
978
+
979
+ export namespace Message {
980
+ export interface Attachment {
981
+ add_to?: Array<'file_search' | 'code_interpreter'>;
982
+
983
+ /**
984
+ * The ID of the file to attach to the message.
985
+ */
986
+ file_id?: string;
987
+ }
988
+ }
989
+
990
+ /**
991
+ * A set of resources that are made available to the assistant's tools in this
992
+ * thread. The resources are specific to the type of tool. For example, the
993
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
994
+ * tool requires a list of vector store IDs.
995
+ */
996
+ export interface ToolResources {
997
+ code_interpreter?: ToolResources.CodeInterpreter;
998
+
999
+ file_search?: ToolResources.FileSearch;
1000
+ }
1001
+
1002
+ export namespace ToolResources {
1003
+ export interface CodeInterpreter {
1004
+ /**
1005
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
1006
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
1007
+ * associated with the tool.
1008
+ */
1009
+ file_ids?: Array<string>;
1010
+ }
1011
+
1012
+ export interface FileSearch {
1013
+ /**
1014
+ * The
1015
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1016
+ * attached to this thread. There can be a maximum of 1 vector store attached to
1017
+ * the thread.
1018
+ */
1019
+ vector_store_ids?: Array<string>;
1020
+
1021
+ /**
1022
+ * A helper to create a
1023
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1024
+ * with file_ids and attach it to this thread. There can be a maximum of 1 vector
1025
+ * store attached to the thread.
1026
+ */
1027
+ vector_stores?: Array<FileSearch.VectorStore>;
1028
+ }
1029
+
1030
+ export namespace FileSearch {
1031
+ export interface VectorStore {
1032
+ /**
1033
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
1034
+ * add to the vector store. There can be a maximum of 10000 files in a vector
1035
+ * store.
1036
+ */
1037
+ file_ids?: Array<string>;
1038
+
1039
+ /**
1040
+ * Set of 16 key-value pairs that can be attached to a vector store. This can be
1041
+ * useful for storing additional information about the vector store in a structured
1042
+ * format. Keys can be a maximum of 64 characters long and values can be a maxium
1043
+ * of 512 characters long.
1044
+ */
1045
+ metadata?: unknown;
1046
+ }
1047
+ }
1048
+ }
1049
+ }
1050
+
1051
+ /**
1052
+ * A set of resources that are used by the assistant's tools. The resources are
1053
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
1054
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
1055
+ * IDs.
1056
+ */
1057
+ export interface ToolResources {
1058
+ code_interpreter?: ToolResources.CodeInterpreter;
1059
+
1060
+ file_search?: ToolResources.FileSearch;
1061
+ }
1062
+
1063
+ export namespace ToolResources {
1064
+ export interface CodeInterpreter {
1065
+ /**
1066
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
1067
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
1068
+ * associated with the tool.
1069
+ */
1070
+ file_ids?: Array<string>;
1071
+ }
1072
+
1073
+ export interface FileSearch {
1074
+ /**
1075
+ * The ID of the
1076
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1077
+ * attached to this assistant. There can be a maximum of 1 vector store attached to
1078
+ * the assistant.
1079
+ */
1080
+ vector_store_ids?: Array<string>;
1081
+ }
672
1082
  }
673
1083
 
674
1084
  export interface TruncationStrategy {
@@ -706,7 +1116,7 @@ export interface ThreadCreateAndRunStreamParams {
706
1116
  * The maximum number of completion tokens that may be used over the course of the
707
1117
  * run. The run will make a best effort to use only the number of completion tokens
708
1118
  * specified, across multiple turns of the run. If the run exceeds the number of
709
- * completion tokens specified, the run will end with status `complete`. See
1119
+ * completion tokens specified, the run will end with status `incomplete`. See
710
1120
  * `incomplete_details` for more info.
711
1121
  */
712
1122
  max_completion_tokens?: number | null;
@@ -715,7 +1125,7 @@ export interface ThreadCreateAndRunStreamParams {
715
1125
  * The maximum number of prompt tokens that may be used over the course of the run.
716
1126
  * The run will make a best effort to use only the number of prompt tokens
717
1127
  * specified, across multiple turns of the run. If the run exceeds the number of
718
- * prompt tokens specified, the run will end with status `complete`. See
1128
+ * prompt tokens specified, the run will end with status `incomplete`. See
719
1129
  * `incomplete_details` for more info.
720
1130
  */
721
1131
  max_prompt_tokens?: number | null;
@@ -796,14 +1206,29 @@ export interface ThreadCreateAndRunStreamParams {
796
1206
  */
797
1207
  tool_choice?: AssistantToolChoiceOption | null;
798
1208
 
1209
+ /**
1210
+ * A set of resources that are used by the assistant's tools. The resources are
1211
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
1212
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
1213
+ * IDs.
1214
+ */
1215
+ tool_resources?: ThreadCreateAndRunStreamParams.ToolResources | null;
1216
+
799
1217
  /**
800
1218
  * Override the tools the assistant can use for this run. This is useful for
801
1219
  * modifying the behavior on a per-run basis.
802
1220
  */
803
1221
  tools?: Array<
804
- AssistantsAPI.CodeInterpreterTool | AssistantsAPI.RetrievalTool | AssistantsAPI.FunctionTool
1222
+ AssistantsAPI.CodeInterpreterTool | AssistantsAPI.FileSearchTool | AssistantsAPI.FunctionTool
805
1223
  > | null;
806
1224
 
1225
+ /**
1226
+ * An alternative to sampling with temperature, called nucleus sampling, where the
1227
+ * model considers the results of the tokens with top_p probability mass. So 0.1
1228
+ * means only the tokens comprising the top 10% probability mass are considered.
1229
+ */
1230
+ top_p?: number | null;
1231
+
807
1232
  truncation_strategy?: ThreadCreateAndRunStreamParams.TruncationStrategy | null;
808
1233
  }
809
1234
 
@@ -825,6 +1250,14 @@ export namespace ThreadCreateAndRunStreamParams {
825
1250
  * characters long.
826
1251
  */
827
1252
  metadata?: unknown | null;
1253
+
1254
+ /**
1255
+ * A set of resources that are made available to the assistant's tools in this
1256
+ * thread. The resources are specific to the type of tool. For example, the
1257
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
1258
+ * tool requires a list of vector store IDs.
1259
+ */
1260
+ tool_resources?: Thread.ToolResources | null;
828
1261
  }
829
1262
 
830
1263
  export namespace Thread {
@@ -845,12 +1278,9 @@ export namespace ThreadCreateAndRunStreamParams {
845
1278
  role: 'user' | 'assistant';
846
1279
 
847
1280
  /**
848
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
849
- * the message should use. There can be a maximum of 10 files attached to a
850
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
851
- * access and use files.
1281
+ * A list of files attached to the message, and the tools they should be added to.
852
1282
  */
853
- file_ids?: Array<string>;
1283
+ attachments?: Array<Message.Attachment> | null;
854
1284
 
855
1285
  /**
856
1286
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -860,6 +1290,110 @@ export namespace ThreadCreateAndRunStreamParams {
860
1290
  */
861
1291
  metadata?: unknown | null;
862
1292
  }
1293
+
1294
+ export namespace Message {
1295
+ export interface Attachment {
1296
+ add_to?: Array<'file_search' | 'code_interpreter'>;
1297
+
1298
+ /**
1299
+ * The ID of the file to attach to the message.
1300
+ */
1301
+ file_id?: string;
1302
+ }
1303
+ }
1304
+
1305
+ /**
1306
+ * A set of resources that are made available to the assistant's tools in this
1307
+ * thread. The resources are specific to the type of tool. For example, the
1308
+ * `code_interpreter` tool requires a list of file IDs, while the `file_search`
1309
+ * tool requires a list of vector store IDs.
1310
+ */
1311
+ export interface ToolResources {
1312
+ code_interpreter?: ToolResources.CodeInterpreter;
1313
+
1314
+ file_search?: ToolResources.FileSearch;
1315
+ }
1316
+
1317
+ export namespace ToolResources {
1318
+ export interface CodeInterpreter {
1319
+ /**
1320
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
1321
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
1322
+ * associated with the tool.
1323
+ */
1324
+ file_ids?: Array<string>;
1325
+ }
1326
+
1327
+ export interface FileSearch {
1328
+ /**
1329
+ * The
1330
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1331
+ * attached to this thread. There can be a maximum of 1 vector store attached to
1332
+ * the thread.
1333
+ */
1334
+ vector_store_ids?: Array<string>;
1335
+
1336
+ /**
1337
+ * A helper to create a
1338
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1339
+ * with file_ids and attach it to this thread. There can be a maximum of 1 vector
1340
+ * store attached to the thread.
1341
+ */
1342
+ vector_stores?: Array<FileSearch.VectorStore>;
1343
+ }
1344
+
1345
+ export namespace FileSearch {
1346
+ export interface VectorStore {
1347
+ /**
1348
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
1349
+ * add to the vector store. There can be a maximum of 10000 files in a vector
1350
+ * store.
1351
+ */
1352
+ file_ids?: Array<string>;
1353
+
1354
+ /**
1355
+ * Set of 16 key-value pairs that can be attached to a vector store. This can be
1356
+ * useful for storing additional information about the vector store in a structured
1357
+ * format. Keys can be a maximum of 64 characters long and values can be a maxium
1358
+ * of 512 characters long.
1359
+ */
1360
+ metadata?: unknown;
1361
+ }
1362
+ }
1363
+ }
1364
+ }
1365
+
1366
+ /**
1367
+ * A set of resources that are used by the assistant's tools. The resources are
1368
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
1369
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
1370
+ * IDs.
1371
+ */
1372
+ export interface ToolResources {
1373
+ code_interpreter?: ToolResources.CodeInterpreter;
1374
+
1375
+ file_search?: ToolResources.FileSearch;
1376
+ }
1377
+
1378
+ export namespace ToolResources {
1379
+ export interface CodeInterpreter {
1380
+ /**
1381
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
1382
+ * available to the `code_interpreter` tool. There can be a maximum of 20 files
1383
+ * associated with the tool.
1384
+ */
1385
+ file_ids?: Array<string>;
1386
+ }
1387
+
1388
+ export interface FileSearch {
1389
+ /**
1390
+ * The ID of the
1391
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1392
+ * attached to this assistant. There can be a maximum of 1 vector store attached to
1393
+ * the assistant.
1394
+ */
1395
+ vector_store_ids?: Array<string>;
1396
+ }
863
1397
  }
864
1398
 
865
1399
  export interface TruncationStrategy {