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
@@ -1,15 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import * as Core from "../../../../core";
4
- import { APIResource } from "../../../../resource";
5
- import { isRequestOptions } from "../../../../core";
3
+ import * as Core from "../../../core";
4
+ import { APIResource } from "../../../resource";
5
+ import { isRequestOptions } from "../../../core";
6
6
  import * as MessagesAPI from "./messages";
7
- import * as FilesAPI from "./files";
8
- import { CursorPage, type CursorPageParams } from "../../../../pagination";
7
+ import { CursorPage, type CursorPageParams } from "../../../pagination";
9
8
 
10
9
  export class Messages extends APIResource {
11
- files: FilesAPI.Files = new FilesAPI.Files(this._client);
12
-
13
10
  /**
14
11
  * Create a message.
15
12
  */
@@ -21,7 +18,7 @@ export class Messages extends APIResource {
21
18
  return this._client.post(`/threads/${threadId}/messages`, {
22
19
  body,
23
20
  ...options,
24
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
21
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
25
22
  });
26
23
  }
27
24
 
@@ -31,7 +28,7 @@ export class Messages extends APIResource {
31
28
  retrieve(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise<Message> {
32
29
  return this._client.get(`/threads/${threadId}/messages/${messageId}`, {
33
30
  ...options,
34
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
31
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
35
32
  });
36
33
  }
37
34
 
@@ -47,7 +44,7 @@ export class Messages extends APIResource {
47
44
  return this._client.post(`/threads/${threadId}/messages/${messageId}`, {
48
45
  body,
49
46
  ...options,
50
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
47
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
51
48
  });
52
49
  }
53
50
 
@@ -71,7 +68,7 @@ export class Messages extends APIResource {
71
68
  return this._client.getAPIList(`/threads/${threadId}/messages`, MessagesPage, {
72
69
  query,
73
70
  ...options,
74
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
71
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
75
72
  });
76
73
  }
77
74
  }
@@ -81,21 +78,21 @@ export class MessagesPage extends CursorPage<Message> {}
81
78
  /**
82
79
  * A citation within the message that points to a specific quote from a specific
83
80
  * File associated with the assistant or the message. Generated when the assistant
84
- * uses the "retrieval" tool to search files.
81
+ * uses the "file_search" tool to search files.
85
82
  */
86
83
  export type Annotation = FileCitationAnnotation | FilePathAnnotation;
87
84
 
88
85
  /**
89
86
  * A citation within the message that points to a specific quote from a specific
90
87
  * File associated with the assistant or the message. Generated when the assistant
91
- * uses the "retrieval" tool to search files.
88
+ * uses the "file_search" tool to search files.
92
89
  */
93
90
  export type AnnotationDelta = FileCitationDeltaAnnotation | FilePathDeltaAnnotation;
94
91
 
95
92
  /**
96
93
  * A citation within the message that points to a specific quote from a specific
97
94
  * File associated with the assistant or the message. Generated when the assistant
98
- * uses the "retrieval" tool to search files.
95
+ * uses the "file_search" tool to search files.
99
96
  */
100
97
  export interface FileCitationAnnotation {
101
98
  end_index: number;
@@ -132,7 +129,7 @@ export namespace FileCitationAnnotation {
132
129
  /**
133
130
  * A citation within the message that points to a specific quote from a specific
134
131
  * File associated with the assistant or the message. Generated when the assistant
135
- * uses the "retrieval" tool to search files.
132
+ * uses the "file_search" tool to search files.
136
133
  */
137
134
  export interface FileCitationDeltaAnnotation {
138
135
  /**
@@ -302,6 +299,11 @@ export interface Message {
302
299
  */
303
300
  assistant_id: string | null;
304
301
 
302
+ /**
303
+ * A list of files attached to the message, and the tools they were added to.
304
+ */
305
+ attachments: Array<Message.Attachment> | null;
306
+
305
307
  /**
306
308
  * The Unix timestamp (in seconds) for when the message was completed.
307
309
  */
@@ -317,13 +319,6 @@ export interface Message {
317
319
  */
318
320
  created_at: number;
319
321
 
320
- /**
321
- * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs that
322
- * the assistant should use. Useful for tools like retrieval and code_interpreter
323
- * that can access files. A maximum of 10 files can be attached to a message.
324
- */
325
- file_ids: Array<string>;
326
-
327
322
  /**
328
323
  * The Unix timestamp (in seconds) for when the message was marked as incomplete.
329
324
  */
@@ -373,6 +368,15 @@ export interface Message {
373
368
  }
374
369
 
375
370
  export namespace Message {
371
+ export interface Attachment {
372
+ add_to?: Array<'file_search' | 'code_interpreter'>;
373
+
374
+ /**
375
+ * The ID of the file to attach to the message.
376
+ */
377
+ file_id?: string;
378
+ }
379
+
376
380
  /**
377
381
  * On an incomplete message, details about why the message is incomplete.
378
382
  */
@@ -413,13 +417,6 @@ export interface MessageDelta {
413
417
  */
414
418
  content?: Array<MessageContentDelta>;
415
419
 
416
- /**
417
- * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs that
418
- * the assistant should use. Useful for tools like retrieval and code_interpreter
419
- * that can access files. A maximum of 10 files can be attached to a message.
420
- */
421
- file_ids?: Array<string>;
422
-
423
420
  /**
424
421
  * The entity that produced the message. One of `user` or `assistant`.
425
422
  */
@@ -511,12 +508,9 @@ export interface MessageCreateParams {
511
508
  role: 'user' | 'assistant';
512
509
 
513
510
  /**
514
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
515
- * the message should use. There can be a maximum of 10 files attached to a
516
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
517
- * access and use files.
511
+ * A list of files attached to the message, and the tools they should be added to.
518
512
  */
519
- file_ids?: Array<string>;
513
+ attachments?: Array<MessageCreateParams.Attachment> | null;
520
514
 
521
515
  /**
522
516
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -527,6 +521,17 @@ export interface MessageCreateParams {
527
521
  metadata?: unknown | null;
528
522
  }
529
523
 
524
+ export namespace MessageCreateParams {
525
+ export interface Attachment {
526
+ add_to?: Array<'file_search' | 'code_interpreter'>;
527
+
528
+ /**
529
+ * The ID of the file to attach to the message.
530
+ */
531
+ file_id?: string;
532
+ }
533
+ }
534
+
530
535
  export interface MessageUpdateParams {
531
536
  /**
532
537
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -583,8 +588,4 @@ export namespace Messages {
583
588
  export import MessageCreateParams = MessagesAPI.MessageCreateParams;
584
589
  export import MessageUpdateParams = MessagesAPI.MessageUpdateParams;
585
590
  export import MessageListParams = MessagesAPI.MessageListParams;
586
- export import Files = FilesAPI.Files;
587
- export import MessageFile = FilesAPI.MessageFile;
588
- export import MessageFilesPage = FilesAPI.MessageFilesPage;
589
- export import FileListParams = FilesAPI.FileListParams;
590
591
  }
@@ -5,11 +5,11 @@ export {
5
5
  CodeInterpreterOutputImage,
6
6
  CodeInterpreterToolCall,
7
7
  CodeInterpreterToolCallDelta,
8
+ FileSearchToolCall,
9
+ FileSearchToolCallDelta,
8
10
  FunctionToolCall,
9
11
  FunctionToolCallDelta,
10
12
  MessageCreationStepDetails,
11
- RetrievalToolCall,
12
- RetrievalToolCallDelta,
13
13
  RunStep,
14
14
  RunStepDelta,
15
15
  RunStepDeltaEvent,
@@ -8,7 +8,7 @@ import { AssistantStream, RunCreateParamsBaseStream } from "../../../../lib/Assi
8
8
  import { sleep } from "../../../../core";
9
9
  import { RunSubmitToolOutputsParamsStream } from "../../../../lib/AssistantStream";
10
10
  import * as RunsAPI from "./runs";
11
- import * as AssistantsAPI from "../../assistants/assistants";
11
+ import * as AssistantsAPI from "../../assistants";
12
12
  import * as ThreadsAPI from "../threads";
13
13
  import * as StepsAPI from "./steps";
14
14
  import { CursorPage, type CursorPageParams } from "../../../../pagination";
@@ -39,7 +39,7 @@ export class Runs extends APIResource {
39
39
  return this._client.post(`/threads/${threadId}/runs`, {
40
40
  body,
41
41
  ...options,
42
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
42
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
43
43
  stream: body.stream ?? false,
44
44
  }) as APIPromise<Run> | APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>;
45
45
  }
@@ -50,7 +50,7 @@ export class Runs extends APIResource {
50
50
  retrieve(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise<Run> {
51
51
  return this._client.get(`/threads/${threadId}/runs/${runId}`, {
52
52
  ...options,
53
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
53
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
54
54
  });
55
55
  }
56
56
 
@@ -66,7 +66,7 @@ export class Runs extends APIResource {
66
66
  return this._client.post(`/threads/${threadId}/runs/${runId}`, {
67
67
  body,
68
68
  ...options,
69
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
69
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
70
70
  });
71
71
  }
72
72
 
@@ -90,7 +90,7 @@ export class Runs extends APIResource {
90
90
  return this._client.getAPIList(`/threads/${threadId}/runs`, RunsPage, {
91
91
  query,
92
92
  ...options,
93
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
93
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
94
94
  });
95
95
  }
96
96
 
@@ -100,7 +100,7 @@ export class Runs extends APIResource {
100
100
  cancel(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise<Run> {
101
101
  return this._client.post(`/threads/${threadId}/runs/${runId}/cancel`, {
102
102
  ...options,
103
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
103
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
104
104
  });
105
105
  }
106
106
 
@@ -224,7 +224,7 @@ export class Runs extends APIResource {
224
224
  return this._client.post(`/threads/${threadId}/runs/${runId}/submit_tool_outputs`, {
225
225
  body,
226
226
  ...options,
227
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
227
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
228
228
  stream: body.stream ?? false,
229
229
  }) as APIPromise<Run> | APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>;
230
230
  }
@@ -350,13 +350,6 @@ export interface Run {
350
350
  */
351
351
  failed_at: number | null;
352
352
 
353
- /**
354
- * The list of [File](https://platform.openai.com/docs/api-reference/files) IDs the
355
- * [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
356
- * this run.
357
- */
358
- file_ids: Array<string>;
359
-
360
353
  /**
361
354
  * Details on why the run is incomplete. Will be `null` if the run is not
362
355
  * incomplete.
@@ -478,6 +471,11 @@ export interface Run {
478
471
  * The sampling temperature used for this run. If not set, defaults to 1.
479
472
  */
480
473
  temperature?: number | null;
474
+
475
+ /**
476
+ * The nucleus sampling value used for this run. If not set, defaults to 1.
477
+ */
478
+ top_p?: number | null;
481
479
  }
482
480
 
483
481
  export namespace Run {
@@ -720,6 +718,13 @@ export interface RunCreateParamsBase {
720
718
  */
721
719
  tools?: Array<AssistantsAPI.AssistantTool> | null;
722
720
 
721
+ /**
722
+ * An alternative to sampling with temperature, called nucleus sampling, where the
723
+ * model considers the results of the tokens with top_p probability mass. So 0.1
724
+ * means only the tokens comprising the top 10% probability mass are considered.
725
+ */
726
+ top_p?: number | null;
727
+
723
728
  truncation_strategy?: RunCreateParams.TruncationStrategy | null;
724
729
  }
725
730
 
@@ -741,12 +746,9 @@ export namespace RunCreateParams {
741
746
  role: 'user' | 'assistant';
742
747
 
743
748
  /**
744
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
745
- * the message should use. There can be a maximum of 10 files attached to a
746
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
747
- * access and use files.
749
+ * A list of files attached to the message, and the tools they should be added to.
748
750
  */
749
- file_ids?: Array<string>;
751
+ attachments?: Array<AdditionalMessage.Attachment> | null;
750
752
 
751
753
  /**
752
754
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -757,6 +759,17 @@ export namespace RunCreateParams {
757
759
  metadata?: unknown | null;
758
760
  }
759
761
 
762
+ export namespace AdditionalMessage {
763
+ export interface Attachment {
764
+ add_to?: Array<'file_search' | 'code_interpreter'>;
765
+
766
+ /**
767
+ * The ID of the file to attach to the message.
768
+ */
769
+ file_id?: string;
770
+ }
771
+ }
772
+
760
773
  export interface TruncationStrategy {
761
774
  /**
762
775
  * The truncation strategy to use for the thread. The default is `auto`. If set to
@@ -943,6 +956,13 @@ export interface RunCreateAndPollParams {
943
956
  */
944
957
  tools?: Array<AssistantsAPI.AssistantTool> | null;
945
958
 
959
+ /**
960
+ * An alternative to sampling with temperature, called nucleus sampling, where the
961
+ * model considers the results of the tokens with top_p probability mass. So 0.1
962
+ * means only the tokens comprising the top 10% probability mass are considered.
963
+ */
964
+ top_p?: number | null;
965
+
946
966
  truncation_strategy?: RunCreateAndPollParams.TruncationStrategy | null;
947
967
  }
948
968
 
@@ -964,12 +984,9 @@ export namespace RunCreateAndPollParams {
964
984
  role: 'user' | 'assistant';
965
985
 
966
986
  /**
967
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
968
- * the message should use. There can be a maximum of 10 files attached to a
969
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
970
- * access and use files.
987
+ * A list of files attached to the message, and the tools they should be added to.
971
988
  */
972
- file_ids?: Array<string>;
989
+ attachments?: Array<AdditionalMessage.Attachment> | null;
973
990
 
974
991
  /**
975
992
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -980,6 +997,17 @@ export namespace RunCreateAndPollParams {
980
997
  metadata?: unknown | null;
981
998
  }
982
999
 
1000
+ export namespace AdditionalMessage {
1001
+ export interface Attachment {
1002
+ add_to?: Array<'file_search' | 'code_interpreter'>;
1003
+
1004
+ /**
1005
+ * The ID of the file to attach to the message.
1006
+ */
1007
+ file_id?: string;
1008
+ }
1009
+ }
1010
+
983
1011
  export interface TruncationStrategy {
984
1012
  /**
985
1013
  * The truncation strategy to use for the thread. The default is `auto`. If set to
@@ -1119,6 +1147,13 @@ export interface RunCreateAndStreamParams {
1119
1147
  */
1120
1148
  tools?: Array<AssistantsAPI.AssistantTool> | null;
1121
1149
 
1150
+ /**
1151
+ * An alternative to sampling with temperature, called nucleus sampling, where the
1152
+ * model considers the results of the tokens with top_p probability mass. So 0.1
1153
+ * means only the tokens comprising the top 10% probability mass are considered.
1154
+ */
1155
+ top_p?: number | null;
1156
+
1122
1157
  truncation_strategy?: RunCreateAndStreamParams.TruncationStrategy | null;
1123
1158
  }
1124
1159
 
@@ -1140,12 +1175,9 @@ export namespace RunCreateAndStreamParams {
1140
1175
  role: 'user' | 'assistant';
1141
1176
 
1142
1177
  /**
1143
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
1144
- * the message should use. There can be a maximum of 10 files attached to a
1145
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
1146
- * access and use files.
1178
+ * A list of files attached to the message, and the tools they should be added to.
1147
1179
  */
1148
- file_ids?: Array<string>;
1180
+ attachments?: Array<AdditionalMessage.Attachment> | null;
1149
1181
 
1150
1182
  /**
1151
1183
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -1156,6 +1188,17 @@ export namespace RunCreateAndStreamParams {
1156
1188
  metadata?: unknown | null;
1157
1189
  }
1158
1190
 
1191
+ export namespace AdditionalMessage {
1192
+ export interface Attachment {
1193
+ add_to?: Array<'file_search' | 'code_interpreter'>;
1194
+
1195
+ /**
1196
+ * The ID of the file to attach to the message.
1197
+ */
1198
+ file_id?: string;
1199
+ }
1200
+ }
1201
+
1159
1202
  export interface TruncationStrategy {
1160
1203
  /**
1161
1204
  * The truncation strategy to use for the thread. The default is `auto`. If set to
@@ -1295,6 +1338,13 @@ export interface RunStreamParams {
1295
1338
  */
1296
1339
  tools?: Array<AssistantsAPI.AssistantTool> | null;
1297
1340
 
1341
+ /**
1342
+ * An alternative to sampling with temperature, called nucleus sampling, where the
1343
+ * model considers the results of the tokens with top_p probability mass. So 0.1
1344
+ * means only the tokens comprising the top 10% probability mass are considered.
1345
+ */
1346
+ top_p?: number | null;
1347
+
1298
1348
  truncation_strategy?: RunStreamParams.TruncationStrategy | null;
1299
1349
  }
1300
1350
 
@@ -1316,12 +1366,9 @@ export namespace RunStreamParams {
1316
1366
  role: 'user' | 'assistant';
1317
1367
 
1318
1368
  /**
1319
- * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
1320
- * the message should use. There can be a maximum of 10 files attached to a
1321
- * message. Useful for tools like `retrieval` and `code_interpreter` that can
1322
- * access and use files.
1369
+ * A list of files attached to the message, and the tools they should be added to.
1323
1370
  */
1324
- file_ids?: Array<string>;
1371
+ attachments?: Array<AdditionalMessage.Attachment> | null;
1325
1372
 
1326
1373
  /**
1327
1374
  * Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -1332,6 +1379,17 @@ export namespace RunStreamParams {
1332
1379
  metadata?: unknown | null;
1333
1380
  }
1334
1381
 
1382
+ export namespace AdditionalMessage {
1383
+ export interface Attachment {
1384
+ add_to?: Array<'file_search' | 'code_interpreter'>;
1385
+
1386
+ /**
1387
+ * The ID of the file to attach to the message.
1388
+ */
1389
+ file_id?: string;
1390
+ }
1391
+ }
1392
+
1335
1393
  export interface TruncationStrategy {
1336
1394
  /**
1337
1395
  * The truncation strategy to use for the thread. The default is `auto`. If set to
@@ -1470,11 +1528,11 @@ export namespace Runs {
1470
1528
  export import CodeInterpreterOutputImage = StepsAPI.CodeInterpreterOutputImage;
1471
1529
  export import CodeInterpreterToolCall = StepsAPI.CodeInterpreterToolCall;
1472
1530
  export import CodeInterpreterToolCallDelta = StepsAPI.CodeInterpreterToolCallDelta;
1531
+ export import FileSearchToolCall = StepsAPI.FileSearchToolCall;
1532
+ export import FileSearchToolCallDelta = StepsAPI.FileSearchToolCallDelta;
1473
1533
  export import FunctionToolCall = StepsAPI.FunctionToolCall;
1474
1534
  export import FunctionToolCallDelta = StepsAPI.FunctionToolCallDelta;
1475
1535
  export import MessageCreationStepDetails = StepsAPI.MessageCreationStepDetails;
1476
- export import RetrievalToolCall = StepsAPI.RetrievalToolCall;
1477
- export import RetrievalToolCallDelta = StepsAPI.RetrievalToolCallDelta;
1478
1536
  export import RunStep = StepsAPI.RunStep;
1479
1537
  export import RunStepDelta = StepsAPI.RunStepDelta;
1480
1538
  export import RunStepDeltaEvent = StepsAPI.RunStepDeltaEvent;
@@ -18,7 +18,7 @@ export class Steps extends APIResource {
18
18
  ): Core.APIPromise<RunStep> {
19
19
  return this._client.get(`/threads/${threadId}/runs/${runId}/steps/${stepId}`, {
20
20
  ...options,
21
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
21
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
22
22
  });
23
23
  }
24
24
 
@@ -48,7 +48,7 @@ export class Steps extends APIResource {
48
48
  return this._client.getAPIList(`/threads/${threadId}/runs/${runId}/steps`, RunStepsPage, {
49
49
  query,
50
50
  ...options,
51
- headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
51
+ headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
52
52
  });
53
53
  }
54
54
  }
@@ -220,6 +220,47 @@ export namespace CodeInterpreterToolCallDelta {
220
220
  }
221
221
  }
222
222
 
223
+ export interface FileSearchToolCall {
224
+ /**
225
+ * The ID of the tool call object.
226
+ */
227
+ id: string;
228
+
229
+ /**
230
+ * For now, this is always going to be an empty object.
231
+ */
232
+ file_search: unknown;
233
+
234
+ /**
235
+ * The type of tool call. This is always going to be `file_search` for this type of
236
+ * tool call.
237
+ */
238
+ type: 'file_search';
239
+ }
240
+
241
+ export interface FileSearchToolCallDelta {
242
+ /**
243
+ * For now, this is always going to be an empty object.
244
+ */
245
+ file_search: unknown;
246
+
247
+ /**
248
+ * The index of the tool call in the tool calls array.
249
+ */
250
+ index: number;
251
+
252
+ /**
253
+ * The type of tool call. This is always going to be `file_search` for this type of
254
+ * tool call.
255
+ */
256
+ type: 'file_search';
257
+
258
+ /**
259
+ * The ID of the tool call object.
260
+ */
261
+ id?: string;
262
+ }
263
+
223
264
  export interface FunctionToolCall {
224
265
  /**
225
266
  * The ID of the tool call object.
@@ -330,47 +371,6 @@ export namespace MessageCreationStepDetails {
330
371
  }
331
372
  }
332
373
 
333
- export interface RetrievalToolCall {
334
- /**
335
- * The ID of the tool call object.
336
- */
337
- id: string;
338
-
339
- /**
340
- * For now, this is always going to be an empty object.
341
- */
342
- retrieval: unknown;
343
-
344
- /**
345
- * The type of tool call. This is always going to be `retrieval` for this type of
346
- * tool call.
347
- */
348
- type: 'retrieval';
349
- }
350
-
351
- export interface RetrievalToolCallDelta {
352
- /**
353
- * The index of the tool call in the tool calls array.
354
- */
355
- index: number;
356
-
357
- /**
358
- * The type of tool call. This is always going to be `retrieval` for this type of
359
- * tool call.
360
- */
361
- type: 'retrieval';
362
-
363
- /**
364
- * The ID of the tool call object.
365
- */
366
- id?: string;
367
-
368
- /**
369
- * For now, this is always going to be an empty object.
370
- */
371
- retrieval?: unknown;
372
- }
373
-
374
374
  /**
375
375
  * Represents a step in execution of a run.
376
376
  */
@@ -561,12 +561,12 @@ export namespace RunStepDeltaMessageDelta {
561
561
  /**
562
562
  * Details of the Code Interpreter tool call the run step was involved in.
563
563
  */
564
- export type ToolCall = CodeInterpreterToolCall | RetrievalToolCall | FunctionToolCall;
564
+ export type ToolCall = CodeInterpreterToolCall | FileSearchToolCall | FunctionToolCall;
565
565
 
566
566
  /**
567
567
  * Details of the Code Interpreter tool call the run step was involved in.
568
568
  */
569
- export type ToolCallDelta = CodeInterpreterToolCallDelta | RetrievalToolCallDelta | FunctionToolCallDelta;
569
+ export type ToolCallDelta = CodeInterpreterToolCallDelta | FileSearchToolCallDelta | FunctionToolCallDelta;
570
570
 
571
571
  /**
572
572
  * Details of the tool call.
@@ -579,7 +579,7 @@ export interface ToolCallDeltaObject {
579
579
 
580
580
  /**
581
581
  * An array of tool calls the run step was involved in. These can be associated
582
- * with one of three types of tools: `code_interpreter`, `retrieval`, or
582
+ * with one of three types of tools: `code_interpreter`, `file_search`, or
583
583
  * `function`.
584
584
  */
585
585
  tool_calls?: Array<ToolCallDelta>;
@@ -591,7 +591,7 @@ export interface ToolCallDeltaObject {
591
591
  export interface ToolCallsStepDetails {
592
592
  /**
593
593
  * An array of tool calls the run step was involved in. These can be associated
594
- * with one of three types of tools: `code_interpreter`, `retrieval`, or
594
+ * with one of three types of tools: `code_interpreter`, `file_search`, or
595
595
  * `function`.
596
596
  */
597
597
  tool_calls: Array<ToolCall>;
@@ -623,11 +623,11 @@ export namespace Steps {
623
623
  export import CodeInterpreterOutputImage = StepsAPI.CodeInterpreterOutputImage;
624
624
  export import CodeInterpreterToolCall = StepsAPI.CodeInterpreterToolCall;
625
625
  export import CodeInterpreterToolCallDelta = StepsAPI.CodeInterpreterToolCallDelta;
626
+ export import FileSearchToolCall = StepsAPI.FileSearchToolCall;
627
+ export import FileSearchToolCallDelta = StepsAPI.FileSearchToolCallDelta;
626
628
  export import FunctionToolCall = StepsAPI.FunctionToolCall;
627
629
  export import FunctionToolCallDelta = StepsAPI.FunctionToolCallDelta;
628
630
  export import MessageCreationStepDetails = StepsAPI.MessageCreationStepDetails;
629
- export import RetrievalToolCall = StepsAPI.RetrievalToolCall;
630
- export import RetrievalToolCallDelta = StepsAPI.RetrievalToolCallDelta;
631
631
  export import RunStep = StepsAPI.RunStep;
632
632
  export import RunStepDelta = StepsAPI.RunStepDelta;
633
633
  export import RunStepDeltaEvent = StepsAPI.RunStepDeltaEvent;