openai 4.86.2 → 4.87.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 (198) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +50 -101
  3. package/core.js +2 -1
  4. package/core.js.map +1 -1
  5. package/core.mjs +2 -1
  6. package/core.mjs.map +1 -1
  7. package/helpers/zod.d.ts +14 -1
  8. package/helpers/zod.d.ts.map +1 -1
  9. package/helpers/zod.js +25 -1
  10. package/helpers/zod.js.map +1 -1
  11. package/helpers/zod.mjs +23 -1
  12. package/helpers/zod.mjs.map +1 -1
  13. package/index.d.mts +14 -3
  14. package/index.d.ts +14 -3
  15. package/index.d.ts.map +1 -1
  16. package/index.js +8 -0
  17. package/index.js.map +1 -1
  18. package/index.mjs +8 -0
  19. package/index.mjs.map +1 -1
  20. package/lib/ResponsesParser.d.ts +33 -0
  21. package/lib/ResponsesParser.d.ts.map +1 -0
  22. package/lib/ResponsesParser.js +171 -0
  23. package/lib/ResponsesParser.js.map +1 -0
  24. package/lib/ResponsesParser.mjs +160 -0
  25. package/lib/ResponsesParser.mjs.map +1 -0
  26. package/lib/parser.d.ts +7 -0
  27. package/lib/parser.d.ts.map +1 -1
  28. package/lib/parser.js +16 -1
  29. package/lib/parser.js.map +1 -1
  30. package/lib/parser.mjs +14 -0
  31. package/lib/parser.mjs.map +1 -1
  32. package/lib/responses/EventTypes.d.ts +9 -0
  33. package/lib/responses/EventTypes.d.ts.map +1 -0
  34. package/lib/responses/EventTypes.js +3 -0
  35. package/lib/responses/EventTypes.js.map +1 -0
  36. package/lib/responses/EventTypes.mjs +2 -0
  37. package/lib/responses/EventTypes.mjs.map +1 -0
  38. package/lib/responses/ResponseStream.d.ts +34 -0
  39. package/lib/responses/ResponseStream.d.ts.map +1 -0
  40. package/lib/responses/ResponseStream.js +238 -0
  41. package/lib/responses/ResponseStream.js.map +1 -0
  42. package/lib/responses/ResponseStream.mjs +234 -0
  43. package/lib/responses/ResponseStream.mjs.map +1 -0
  44. package/package.json +1 -1
  45. package/resources/beta/assistants.d.ts +41 -9
  46. package/resources/beta/assistants.d.ts.map +1 -1
  47. package/resources/beta/assistants.js.map +1 -1
  48. package/resources/beta/assistants.mjs.map +1 -1
  49. package/resources/beta/beta.d.ts +0 -4
  50. package/resources/beta/beta.d.ts.map +1 -1
  51. package/resources/beta/beta.js +0 -5
  52. package/resources/beta/beta.js.map +1 -1
  53. package/resources/beta/beta.mjs +0 -5
  54. package/resources/beta/beta.mjs.map +1 -1
  55. package/resources/beta/index.d.ts +0 -1
  56. package/resources/beta/index.d.ts.map +1 -1
  57. package/resources/beta/index.js +1 -4
  58. package/resources/beta/index.js.map +1 -1
  59. package/resources/beta/index.mjs +0 -1
  60. package/resources/beta/index.mjs.map +1 -1
  61. package/resources/beta/threads/runs/runs.d.ts +3 -4
  62. package/resources/beta/threads/runs/runs.d.ts.map +1 -1
  63. package/resources/beta/threads/runs/runs.js.map +1 -1
  64. package/resources/beta/threads/runs/runs.mjs.map +1 -1
  65. package/resources/beta/threads/threads.d.ts +73 -7
  66. package/resources/beta/threads/threads.d.ts.map +1 -1
  67. package/resources/beta/threads/threads.js.map +1 -1
  68. package/resources/beta/threads/threads.mjs.map +1 -1
  69. package/resources/chat/chat.d.ts +3 -2
  70. package/resources/chat/chat.d.ts.map +1 -1
  71. package/resources/chat/chat.js.map +1 -1
  72. package/resources/chat/chat.mjs.map +1 -1
  73. package/resources/chat/completions/completions.d.ts +200 -64
  74. package/resources/chat/completions/completions.d.ts.map +1 -1
  75. package/resources/chat/completions/completions.js +3 -3
  76. package/resources/chat/completions/completions.js.map +1 -1
  77. package/resources/chat/completions/completions.mjs +3 -3
  78. package/resources/chat/completions/completions.mjs.map +1 -1
  79. package/resources/chat/completions/index.d.ts +1 -1
  80. package/resources/chat/completions/index.d.ts.map +1 -1
  81. package/resources/chat/completions/index.js.map +1 -1
  82. package/resources/chat/completions/index.mjs.map +1 -1
  83. package/resources/chat/completions/messages.d.ts +1 -1
  84. package/resources/chat/index.d.ts +2 -2
  85. package/resources/chat/index.d.ts.map +1 -1
  86. package/resources/chat/index.js.map +1 -1
  87. package/resources/chat/index.mjs.map +1 -1
  88. package/resources/files.d.ts +9 -17
  89. package/resources/files.d.ts.map +1 -1
  90. package/resources/files.js.map +1 -1
  91. package/resources/files.mjs.map +1 -1
  92. package/resources/index.d.ts +2 -0
  93. package/resources/index.d.ts.map +1 -1
  94. package/resources/index.js +7 -1
  95. package/resources/index.js.map +1 -1
  96. package/resources/index.mjs +2 -0
  97. package/resources/index.mjs.map +1 -1
  98. package/resources/responses/index.d.ts +3 -0
  99. package/resources/responses/index.d.ts.map +1 -0
  100. package/resources/responses/index.js +10 -0
  101. package/resources/responses/index.js.map +1 -0
  102. package/resources/responses/index.mjs +4 -0
  103. package/resources/responses/index.mjs.map +1 -0
  104. package/resources/responses/input-items.d.ts +169 -0
  105. package/resources/responses/input-items.d.ts.map +1 -0
  106. package/resources/responses/input-items.js +24 -0
  107. package/resources/responses/input-items.js.map +1 -0
  108. package/resources/responses/input-items.mjs +19 -0
  109. package/resources/responses/input-items.mjs.map +1 -0
  110. package/resources/responses/responses.d.ts +2230 -0
  111. package/resources/responses/responses.d.ts.map +1 -0
  112. package/resources/responses/responses.js +77 -0
  113. package/resources/responses/responses.js.map +1 -0
  114. package/resources/responses/responses.mjs +50 -0
  115. package/resources/responses/responses.mjs.map +1 -0
  116. package/resources/shared.d.ts +99 -4
  117. package/resources/shared.d.ts.map +1 -1
  118. package/resources/uploads/uploads.d.ts +3 -4
  119. package/resources/uploads/uploads.d.ts.map +1 -1
  120. package/resources/uploads/uploads.js +3 -4
  121. package/resources/uploads/uploads.js.map +1 -1
  122. package/resources/uploads/uploads.mjs +3 -4
  123. package/resources/uploads/uploads.mjs.map +1 -1
  124. package/resources/{beta/vector-stores → vector-stores}/file-batches.d.ts +12 -4
  125. package/resources/vector-stores/file-batches.d.ts.map +1 -0
  126. package/resources/{beta/vector-stores → vector-stores}/file-batches.js +4 -4
  127. package/resources/vector-stores/file-batches.js.map +1 -0
  128. package/resources/{beta/vector-stores → vector-stores}/file-batches.mjs +4 -4
  129. package/resources/vector-stores/file-batches.mjs.map +1 -0
  130. package/resources/{beta/vector-stores → vector-stores}/files.d.ts +54 -5
  131. package/resources/vector-stores/files.d.ts.map +1 -0
  132. package/resources/{beta/vector-stores → vector-stores}/files.js +27 -4
  133. package/resources/vector-stores/files.js.map +1 -0
  134. package/resources/{beta/vector-stores → vector-stores}/files.mjs +25 -3
  135. package/resources/vector-stores/files.mjs.map +1 -0
  136. package/resources/vector-stores/index.d.ts +4 -0
  137. package/resources/vector-stores/index.d.ts.map +1 -0
  138. package/resources/{beta/vector-stores → vector-stores}/index.js +3 -1
  139. package/resources/vector-stores/index.js.map +1 -0
  140. package/resources/vector-stores/index.mjs +5 -0
  141. package/resources/vector-stores/index.mjs.map +1 -0
  142. package/resources/{beta/vector-stores → vector-stores}/vector-stores.d.ts +90 -7
  143. package/resources/vector-stores/vector-stores.d.ts.map +1 -0
  144. package/resources/{beta/vector-stores → vector-stores}/vector-stores.js +24 -4
  145. package/resources/vector-stores/vector-stores.js.map +1 -0
  146. package/resources/{beta/vector-stores → vector-stores}/vector-stores.mjs +23 -4
  147. package/resources/vector-stores/vector-stores.mjs.map +1 -0
  148. package/src/core.ts +2 -2
  149. package/src/helpers/zod.ts +46 -0
  150. package/src/index.ts +54 -4
  151. package/src/lib/ResponsesParser.ts +262 -0
  152. package/src/lib/parser.ts +28 -0
  153. package/src/lib/responses/EventTypes.ts +76 -0
  154. package/src/lib/responses/ResponseStream.ts +298 -0
  155. package/src/resources/beta/assistants.ts +46 -9
  156. package/src/resources/beta/beta.ts +0 -37
  157. package/src/resources/beta/index.ts +0 -16
  158. package/src/resources/beta/threads/runs/runs.ts +3 -4
  159. package/src/resources/beta/threads/threads.ts +83 -7
  160. package/src/resources/chat/chat.ts +3 -43
  161. package/src/resources/chat/completions/completions.ts +224 -66
  162. package/src/resources/chat/completions/index.ts +0 -1
  163. package/src/resources/chat/completions/messages.ts +1 -1
  164. package/src/resources/chat/index.ts +1 -2
  165. package/src/resources/files.ts +9 -17
  166. package/src/resources/index.ts +20 -0
  167. package/src/resources/responses/index.ts +9 -0
  168. package/src/resources/responses/input-items.ts +276 -0
  169. package/src/resources/responses/responses.ts +2761 -0
  170. package/src/resources/shared.ts +152 -4
  171. package/src/resources/uploads/uploads.ts +3 -4
  172. package/src/resources/{beta/vector-stores → vector-stores}/file-batches.ts +16 -7
  173. package/src/resources/{beta/vector-stores → vector-stores}/files.ts +85 -4
  174. package/src/resources/{beta/vector-stores → vector-stores}/index.ts +6 -0
  175. package/src/resources/{beta/vector-stores → vector-stores}/vector-stores.ts +125 -5
  176. package/src/streaming.ts +1 -1
  177. package/src/version.ts +1 -1
  178. package/streaming.js +1 -1
  179. package/streaming.js.map +1 -1
  180. package/streaming.mjs +1 -1
  181. package/streaming.mjs.map +1 -1
  182. package/version.d.ts +1 -1
  183. package/version.js +1 -1
  184. package/version.mjs +1 -1
  185. package/resources/beta/vector-stores/file-batches.d.ts.map +0 -1
  186. package/resources/beta/vector-stores/file-batches.js.map +0 -1
  187. package/resources/beta/vector-stores/file-batches.mjs.map +0 -1
  188. package/resources/beta/vector-stores/files.d.ts.map +0 -1
  189. package/resources/beta/vector-stores/files.js.map +0 -1
  190. package/resources/beta/vector-stores/files.mjs.map +0 -1
  191. package/resources/beta/vector-stores/index.d.ts +0 -4
  192. package/resources/beta/vector-stores/index.d.ts.map +0 -1
  193. package/resources/beta/vector-stores/index.js.map +0 -1
  194. package/resources/beta/vector-stores/index.mjs +0 -5
  195. package/resources/beta/vector-stores/index.mjs.map +0 -1
  196. package/resources/beta/vector-stores/vector-stores.d.ts.map +0 -1
  197. package/resources/beta/vector-stores/vector-stores.js.map +0 -1
  198. package/resources/beta/vector-stores/vector-stores.mjs.map +0 -1
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../resource';
4
+ import * as Shared from '../shared';
4
5
  import * as CompletionsAPI from './completions/completions';
5
6
  import {
6
7
  ChatCompletion,
@@ -52,48 +53,7 @@ export class Chat extends APIResource {
52
53
  completions: CompletionsAPI.Completions = new CompletionsAPI.Completions(this._client);
53
54
  }
54
55
 
55
- export type ChatModel =
56
- | 'o3-mini'
57
- | 'o3-mini-2025-01-31'
58
- | 'o1'
59
- | 'o1-2024-12-17'
60
- | 'o1-preview'
61
- | 'o1-preview-2024-09-12'
62
- | 'o1-mini'
63
- | 'o1-mini-2024-09-12'
64
- | 'gpt-4.5-preview'
65
- | 'gpt-4.5-preview-2025-02-27'
66
- | 'gpt-4o'
67
- | 'gpt-4o-2024-11-20'
68
- | 'gpt-4o-2024-08-06'
69
- | 'gpt-4o-2024-05-13'
70
- | 'gpt-4o-audio-preview'
71
- | 'gpt-4o-audio-preview-2024-10-01'
72
- | 'gpt-4o-audio-preview-2024-12-17'
73
- | 'gpt-4o-mini-audio-preview'
74
- | 'gpt-4o-mini-audio-preview-2024-12-17'
75
- | 'chatgpt-4o-latest'
76
- | 'gpt-4o-mini'
77
- | 'gpt-4o-mini-2024-07-18'
78
- | 'gpt-4-turbo'
79
- | 'gpt-4-turbo-2024-04-09'
80
- | 'gpt-4-0125-preview'
81
- | 'gpt-4-turbo-preview'
82
- | 'gpt-4-1106-preview'
83
- | 'gpt-4-vision-preview'
84
- | 'gpt-4'
85
- | 'gpt-4-0314'
86
- | 'gpt-4-0613'
87
- | 'gpt-4-32k'
88
- | 'gpt-4-32k-0314'
89
- | 'gpt-4-32k-0613'
90
- | 'gpt-3.5-turbo'
91
- | 'gpt-3.5-turbo-16k'
92
- | 'gpt-3.5-turbo-0301'
93
- | 'gpt-3.5-turbo-0613'
94
- | 'gpt-3.5-turbo-1106'
95
- | 'gpt-3.5-turbo-0125'
96
- | 'gpt-3.5-turbo-16k-0613';
56
+ export type ChatModel = Shared.ChatModel;
97
57
 
98
58
  Chat.Completions = Completions;
99
59
  Chat.ChatCompletionsPage = ChatCompletionsPage;
@@ -123,7 +83,6 @@ export declare namespace Chat {
123
83
  type ChatCompletionModality as ChatCompletionModality,
124
84
  type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice,
125
85
  type ChatCompletionPredictionContent as ChatCompletionPredictionContent,
126
- type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort,
127
86
  type ChatCompletionRole as ChatCompletionRole,
128
87
  type ChatCompletionStoreMessage as ChatCompletionStoreMessage,
129
88
  type ChatCompletionStreamOptions as ChatCompletionStreamOptions,
@@ -134,6 +93,7 @@ export declare namespace Chat {
134
93
  type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam,
135
94
  type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam,
136
95
  type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage,
96
+ type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort,
137
97
  ChatCompletionsPage as ChatCompletionsPage,
138
98
  type ChatCompletionCreateParams as ChatCompletionCreateParams,
139
99
  type CompletionCreateParams as CompletionCreateParams,
@@ -7,7 +7,6 @@ import * as Core from '../../../core';
7
7
  import * as CompletionsCompletionsAPI from './completions';
8
8
  import * as CompletionsAPI from '../../completions';
9
9
  import * as Shared from '../../shared';
10
- import * as ChatAPI from '../chat';
11
10
  import * as MessagesAPI from './messages';
12
11
  import { MessageListParams, Messages } from './messages';
13
12
  import { CursorPage, type CursorPageParams } from '../../../pagination';
@@ -17,6 +16,13 @@ export class Completions extends APIResource {
17
16
  messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
18
17
 
19
18
  /**
19
+ * **Starting a new project?** We recommend trying
20
+ * [Responses](https://platform.openai.com/docs/api-reference/responses) to take
21
+ * advantage of the latest OpenAI platform features. Compare
22
+ * [Chat Completions with Responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses).
23
+ *
24
+ * ---
25
+ *
20
26
  * Creates a model response for the given chat conversation. Learn more in the
21
27
  * [text generation](https://platform.openai.com/docs/guides/text-generation),
22
28
  * [vision](https://platform.openai.com/docs/guides/vision), and
@@ -50,7 +56,7 @@ export class Completions extends APIResource {
50
56
  }
51
57
 
52
58
  /**
53
- * Get a stored chat completion. Only chat completions that have been created with
59
+ * Get a stored chat completion. Only Chat Completions that have been created with
54
60
  * the `store` parameter set to `true` will be returned.
55
61
  */
56
62
  retrieve(completionId: string, options?: Core.RequestOptions): Core.APIPromise<ChatCompletion> {
@@ -58,7 +64,7 @@ export class Completions extends APIResource {
58
64
  }
59
65
 
60
66
  /**
61
- * Modify a stored chat completion. Only chat completions that have been created
67
+ * Modify a stored chat completion. Only Chat Completions that have been created
62
68
  * with the `store` parameter set to `true` can be modified. Currently, the only
63
69
  * supported modification is to update the `metadata` field.
64
70
  */
@@ -71,7 +77,7 @@ export class Completions extends APIResource {
71
77
  }
72
78
 
73
79
  /**
74
- * List stored chat completions. Only chat completions that have been stored with
80
+ * List stored Chat Completions. Only Chat Completions that have been stored with
75
81
  * the `store` parameter set to `true` will be returned.
76
82
  */
77
83
  list(
@@ -90,7 +96,7 @@ export class Completions extends APIResource {
90
96
  }
91
97
 
92
98
  /**
93
- * Delete a stored chat completion. Only chat completions that have been created
99
+ * Delete a stored chat completion. Only Chat Completions that have been created
94
100
  * with the `store` parameter set to `true` can be deleted.
95
101
  */
96
102
  del(completionId: string, options?: Core.RequestOptions): Core.APIPromise<ChatCompletionDeleted> {
@@ -316,16 +322,16 @@ export interface ChatCompletionAudioParam {
316
322
  format: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16';
317
323
 
318
324
  /**
319
- * The voice the model uses to respond. Supported voices are `ash`, `ballad`,
320
- * `coral`, `sage`, and `verse` (also supported but not recommended are `alloy`,
321
- * `echo`, and `shimmer`; these voices are less expressive).
325
+ * The voice the model uses to respond. Supported voices are `alloy`, `ash`,
326
+ * `ballad`, `coral`, `echo`, `sage`, and `shimmer`.
322
327
  */
323
328
  voice: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse';
324
329
  }
325
330
 
326
331
  /**
327
- * Represents a streamed chunk of a chat completion response returned by model,
332
+ * Represents a streamed chunk of a chat completion response returned by the model,
328
333
  * based on the provided input.
334
+ * [Learn more](https://platform.openai.com/docs/guides/streaming-responses).
329
335
  */
330
336
  export interface ChatCompletionChunk {
331
337
  /**
@@ -512,7 +518,43 @@ export namespace ChatCompletionChunk {
512
518
  export type ChatCompletionContentPart =
513
519
  | ChatCompletionContentPartText
514
520
  | ChatCompletionContentPartImage
515
- | ChatCompletionContentPartInputAudio;
521
+ | ChatCompletionContentPartInputAudio
522
+ | ChatCompletionContentPart.File;
523
+
524
+ export namespace ChatCompletionContentPart {
525
+ /**
526
+ * Learn about [file inputs](https://platform.openai.com/docs/guides/text) for text
527
+ * generation.
528
+ */
529
+ export interface File {
530
+ file: File.File;
531
+
532
+ /**
533
+ * The type of the content part. Always `file`.
534
+ */
535
+ type: 'file';
536
+ }
537
+
538
+ export namespace File {
539
+ export interface File {
540
+ /**
541
+ * The base64 encoded file data, used when passing the file to the model as a
542
+ * string.
543
+ */
544
+ file_data?: string;
545
+
546
+ /**
547
+ * The ID of an uploaded file to use as input.
548
+ */
549
+ file_id?: string;
550
+
551
+ /**
552
+ * The name of the file, used when passing the file to the model as a string.
553
+ */
554
+ file_name?: string;
555
+ }
556
+ }
557
+ }
516
558
 
517
559
  /**
518
560
  * Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
@@ -685,6 +727,12 @@ export interface ChatCompletionMessage {
685
727
  */
686
728
  role: 'assistant';
687
729
 
730
+ /**
731
+ * Annotations for the message, when applicable, as when using the
732
+ * [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).
733
+ */
734
+ annotations?: Array<ChatCompletionMessage.Annotation>;
735
+
688
736
  /**
689
737
  * If the audio output modality is requested, this object contains data about the
690
738
  * audio response from the model.
@@ -705,6 +753,48 @@ export interface ChatCompletionMessage {
705
753
  }
706
754
 
707
755
  export namespace ChatCompletionMessage {
756
+ /**
757
+ * A URL citation when using web search.
758
+ */
759
+ export interface Annotation {
760
+ /**
761
+ * The type of the URL citation. Always `url_citation`.
762
+ */
763
+ type: 'url_citation';
764
+
765
+ /**
766
+ * A URL citation when using web search.
767
+ */
768
+ url_citation: Annotation.URLCitation;
769
+ }
770
+
771
+ export namespace Annotation {
772
+ /**
773
+ * A URL citation when using web search.
774
+ */
775
+ export interface URLCitation {
776
+ /**
777
+ * The index of the last character of the URL citation in the message.
778
+ */
779
+ end_index: number;
780
+
781
+ /**
782
+ * The index of the first character of the URL citation in the message.
783
+ */
784
+ start_index: number;
785
+
786
+ /**
787
+ * The title of the web resource.
788
+ */
789
+ title: string;
790
+
791
+ /**
792
+ * The URL of the web resource.
793
+ */
794
+ url: string;
795
+ }
796
+ }
797
+
708
798
  /**
709
799
  * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a
710
800
  * function that should be called, as generated by the model.
@@ -818,16 +908,6 @@ export interface ChatCompletionPredictionContent {
818
908
  type: 'content';
819
909
  }
820
910
 
821
- /**
822
- * **o1 and o3-mini models only**
823
- *
824
- * Constrains effort on reasoning for
825
- * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
826
- * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
827
- * result in faster responses and fewer tokens used on reasoning in a response.
828
- */
829
- export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high' | null;
830
-
831
911
  /**
832
912
  * The role of the author of a message
833
913
  */
@@ -998,6 +1078,8 @@ export interface ChatCompletionUserMessageParam {
998
1078
  */
999
1079
  export type CreateChatCompletionRequestMessage = ChatCompletionMessageParam;
1000
1080
 
1081
+ export type ChatCompletionReasoningEffort = Shared.ReasoningEffort | null;
1082
+
1001
1083
  export type ChatCompletionCreateParams =
1002
1084
  | ChatCompletionCreateParamsNonStreaming
1003
1085
  | ChatCompletionCreateParamsStreaming;
@@ -1014,11 +1096,13 @@ export interface ChatCompletionCreateParamsBase {
1014
1096
  messages: Array<ChatCompletionMessageParam>;
1015
1097
 
1016
1098
  /**
1017
- * ID of the model to use. See the
1018
- * [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility)
1019
- * table for details on which models work with the Chat API.
1099
+ * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a
1100
+ * wide range of models with different capabilities, performance characteristics,
1101
+ * and price points. Refer to the
1102
+ * [model guide](https://platform.openai.com/docs/models) to browse and compare
1103
+ * available models.
1020
1104
  */
1021
- model: (string & {}) | ChatAPI.ChatModel;
1105
+ model: (string & {}) | Shared.ChatModel;
1022
1106
 
1023
1107
  /**
1024
1108
  * Parameters for audio output. Required when audio output is requested with
@@ -1107,8 +1191,8 @@ export interface ChatCompletionCreateParamsBase {
1107
1191
  metadata?: Shared.Metadata | null;
1108
1192
 
1109
1193
  /**
1110
- * Output types that you would like the model to generate for this request. Most
1111
- * models are capable of generating text, which is the default:
1194
+ * Output types that you would like the model to generate. Most models are capable
1195
+ * of generating text, which is the default:
1112
1196
  *
1113
1197
  * `["text"]`
1114
1198
  *
@@ -1118,7 +1202,7 @@ export interface ChatCompletionCreateParamsBase {
1118
1202
  *
1119
1203
  * `["text", "audio"]`
1120
1204
  */
1121
- modalities?: Array<ChatCompletionModality> | null;
1205
+ modalities?: Array<'text' | 'audio'> | null;
1122
1206
 
1123
1207
  /**
1124
1208
  * How many chat completion choices to generate for each input message. Note that
@@ -1148,14 +1232,14 @@ export interface ChatCompletionCreateParamsBase {
1148
1232
  presence_penalty?: number | null;
1149
1233
 
1150
1234
  /**
1151
- * **o1 and o3-mini models only**
1235
+ * **o-series models only**
1152
1236
  *
1153
1237
  * Constrains effort on reasoning for
1154
1238
  * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
1155
1239
  * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
1156
1240
  * result in faster responses and fewer tokens used on reasoning in a response.
1157
1241
  */
1158
- reasoning_effort?: ChatCompletionReasoningEffort | null;
1242
+ reasoning_effort?: Shared.ReasoningEffort | null;
1159
1243
 
1160
1244
  /**
1161
1245
  * An object specifying the format that the model must output.
@@ -1165,21 +1249,14 @@ export interface ChatCompletionCreateParamsBase {
1165
1249
  * in the
1166
1250
  * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
1167
1251
  *
1168
- * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
1169
- * message the model generates is valid JSON.
1170
- *
1171
- * **Important:** when using JSON mode, you **must** also instruct the model to
1172
- * produce JSON yourself via a system or user message. Without this, the model may
1173
- * generate an unending stream of whitespace until the generation reaches the token
1174
- * limit, resulting in a long-running and seemingly "stuck" request. Also note that
1175
- * the message content may be partially cut off if `finish_reason="length"`, which
1176
- * indicates the generation exceeded `max_tokens` or the conversation exceeded the
1177
- * max context length.
1252
+ * Setting to `{ "type": "json_object" }` enables the older JSON mode, which
1253
+ * ensures the message the model generates is valid JSON. Using `json_schema` is
1254
+ * preferred for models that support it.
1178
1255
  */
1179
1256
  response_format?:
1180
1257
  | Shared.ResponseFormatText
1181
- | Shared.ResponseFormatJSONObject
1182
- | Shared.ResponseFormatJSONSchema;
1258
+ | Shared.ResponseFormatJSONSchema
1259
+ | Shared.ResponseFormatJSONObject;
1183
1260
 
1184
1261
  /**
1185
1262
  * This feature is in Beta. If specified, our system will make a best effort to
@@ -1198,15 +1275,19 @@ export interface ChatCompletionCreateParamsBase {
1198
1275
  * utilize scale tier credits until they are exhausted.
1199
1276
  * - If set to 'auto', and the Project is not Scale tier enabled, the request will
1200
1277
  * be processed using the default service tier with a lower uptime SLA and no
1201
- * latency guarantee.
1278
+ * latency guarentee.
1202
1279
  * - If set to 'default', the request will be processed using the default service
1203
- * tier with a lower uptime SLA and no latency guarantee.
1280
+ * tier with a lower uptime SLA and no latency guarentee.
1204
1281
  * - When not set, the default behavior is 'auto'.
1282
+ *
1283
+ * When this parameter is set, the response body will include the `service_tier`
1284
+ * utilized.
1205
1285
  */
1206
1286
  service_tier?: 'auto' | 'default' | null;
1207
1287
 
1208
1288
  /**
1209
- * Up to 4 sequences where the API will stop generating further tokens.
1289
+ * Up to 4 sequences where the API will stop generating further tokens. The
1290
+ * returned text will not contain the stop sequence.
1210
1291
  */
1211
1292
  stop?: string | null | Array<string>;
1212
1293
 
@@ -1218,12 +1299,14 @@ export interface ChatCompletionCreateParamsBase {
1218
1299
  store?: boolean | null;
1219
1300
 
1220
1301
  /**
1221
- * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
1222
- * sent as data-only
1223
- * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
1224
- * as they become available, with the stream terminated by a `data: [DONE]`
1225
- * message.
1226
- * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).
1302
+ * If set to true, the model response data will be streamed to the client as it is
1303
+ * generated using
1304
+ * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
1305
+ * See the
1306
+ * [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming)
1307
+ * for more information, along with the
1308
+ * [streaming responses](https://platform.openai.com/docs/guides/streaming-responses)
1309
+ * guide for more information on how to handle the streaming events.
1227
1310
  */
1228
1311
  stream?: boolean | null;
1229
1312
 
@@ -1282,6 +1365,13 @@ export interface ChatCompletionCreateParamsBase {
1282
1365
  * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
1283
1366
  */
1284
1367
  user?: string;
1368
+
1369
+ /**
1370
+ * This tool searches the web for relevant results to use in a response. Learn more
1371
+ * about the
1372
+ * [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).
1373
+ */
1374
+ web_search_options?: ChatCompletionCreateParams.WebSearchOptions;
1285
1375
  }
1286
1376
 
1287
1377
  export namespace ChatCompletionCreateParams {
@@ -1313,6 +1403,70 @@ export namespace ChatCompletionCreateParams {
1313
1403
  parameters?: Shared.FunctionParameters;
1314
1404
  }
1315
1405
 
1406
+ /**
1407
+ * This tool searches the web for relevant results to use in a response. Learn more
1408
+ * about the
1409
+ * [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).
1410
+ */
1411
+ export interface WebSearchOptions {
1412
+ /**
1413
+ * High level guidance for the amount of context window space to use for the
1414
+ * search. One of `low`, `medium`, or `high`. `medium` is the default.
1415
+ */
1416
+ search_context_size?: 'low' | 'medium' | 'high';
1417
+
1418
+ /**
1419
+ * Approximate location parameters for the search.
1420
+ */
1421
+ user_location?: WebSearchOptions.UserLocation | null;
1422
+ }
1423
+
1424
+ export namespace WebSearchOptions {
1425
+ /**
1426
+ * Approximate location parameters for the search.
1427
+ */
1428
+ export interface UserLocation {
1429
+ /**
1430
+ * Approximate location parameters for the search.
1431
+ */
1432
+ approximate: UserLocation.Approximate;
1433
+
1434
+ /**
1435
+ * The type of location approximation. Always `approximate`.
1436
+ */
1437
+ type: 'approximate';
1438
+ }
1439
+
1440
+ export namespace UserLocation {
1441
+ /**
1442
+ * Approximate location parameters for the search.
1443
+ */
1444
+ export interface Approximate {
1445
+ /**
1446
+ * Free text input for the city of the user, e.g. `San Francisco`.
1447
+ */
1448
+ city?: string;
1449
+
1450
+ /**
1451
+ * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
1452
+ * the user, e.g. `US`.
1453
+ */
1454
+ country?: string;
1455
+
1456
+ /**
1457
+ * Free text input for the region of the user, e.g. `California`.
1458
+ */
1459
+ region?: string;
1460
+
1461
+ /**
1462
+ * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
1463
+ * user, e.g. `America/Los_Angeles`.
1464
+ */
1465
+ timezone?: string;
1466
+ }
1467
+ }
1468
+ }
1469
+
1316
1470
  export type ChatCompletionCreateParamsNonStreaming =
1317
1471
  CompletionsCompletionsAPI.ChatCompletionCreateParamsNonStreaming;
1318
1472
  export type ChatCompletionCreateParamsStreaming =
@@ -1326,12 +1480,14 @@ export type CompletionCreateParams = ChatCompletionCreateParams;
1326
1480
 
1327
1481
  export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
1328
1482
  /**
1329
- * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
1330
- * sent as data-only
1331
- * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
1332
- * as they become available, with the stream terminated by a `data: [DONE]`
1333
- * message.
1334
- * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).
1483
+ * If set to true, the model response data will be streamed to the client as it is
1484
+ * generated using
1485
+ * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
1486
+ * See the
1487
+ * [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming)
1488
+ * for more information, along with the
1489
+ * [streaming responses](https://platform.openai.com/docs/guides/streaming-responses)
1490
+ * guide for more information on how to handle the streaming events.
1335
1491
  */
1336
1492
  stream?: false | null;
1337
1493
  }
@@ -1343,12 +1499,14 @@ export type CompletionCreateParamsNonStreaming = ChatCompletionCreateParamsNonSt
1343
1499
 
1344
1500
  export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
1345
1501
  /**
1346
- * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
1347
- * sent as data-only
1348
- * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
1349
- * as they become available, with the stream terminated by a `data: [DONE]`
1350
- * message.
1351
- * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).
1502
+ * If set to true, the model response data will be streamed to the client as it is
1503
+ * generated using
1504
+ * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
1505
+ * See the
1506
+ * [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming)
1507
+ * for more information, along with the
1508
+ * [streaming responses](https://platform.openai.com/docs/guides/streaming-responses)
1509
+ * guide for more information on how to handle the streaming events.
1352
1510
  */
1353
1511
  stream: true;
1354
1512
  }
@@ -1377,19 +1535,19 @@ export type CompletionUpdateParams = ChatCompletionUpdateParams;
1377
1535
 
1378
1536
  export interface ChatCompletionListParams extends CursorPageParams {
1379
1537
  /**
1380
- * A list of metadata keys to filter the chat completions by. Example:
1538
+ * A list of metadata keys to filter the Chat Completions by. Example:
1381
1539
  *
1382
1540
  * `metadata[key1]=value1&metadata[key2]=value2`
1383
1541
  */
1384
1542
  metadata?: Shared.Metadata | null;
1385
1543
 
1386
1544
  /**
1387
- * The model used to generate the chat completions.
1545
+ * The model used to generate the Chat Completions.
1388
1546
  */
1389
1547
  model?: string;
1390
1548
 
1391
1549
  /**
1392
- * Sort order for chat completions by timestamp. Use `asc` for ascending order or
1550
+ * Sort order for Chat Completions by timestamp. Use `asc` for ascending order or
1393
1551
  * `desc` for descending order. Defaults to `asc`.
1394
1552
  */
1395
1553
  order?: 'asc' | 'desc';
@@ -1425,7 +1583,6 @@ export declare namespace Completions {
1425
1583
  type ChatCompletionModality as ChatCompletionModality,
1426
1584
  type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice,
1427
1585
  type ChatCompletionPredictionContent as ChatCompletionPredictionContent,
1428
- type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort,
1429
1586
  type ChatCompletionRole as ChatCompletionRole,
1430
1587
  type ChatCompletionStoreMessage as ChatCompletionStoreMessage,
1431
1588
  type ChatCompletionStreamOptions as ChatCompletionStreamOptions,
@@ -1436,6 +1593,7 @@ export declare namespace Completions {
1436
1593
  type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam,
1437
1594
  type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam,
1438
1595
  type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage,
1596
+ type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort,
1439
1597
  ChatCompletionsPage as ChatCompletionsPage,
1440
1598
  type ChatCompletionCreateParams as ChatCompletionCreateParams,
1441
1599
  type CompletionCreateParams as CompletionCreateParams,
@@ -24,7 +24,6 @@ export {
24
24
  type ChatCompletionModality,
25
25
  type ChatCompletionNamedToolChoice,
26
26
  type ChatCompletionPredictionContent,
27
- type ChatCompletionReasoningEffort,
28
27
  type ChatCompletionRole,
29
28
  type ChatCompletionStoreMessage,
30
29
  type ChatCompletionStreamOptions,
@@ -9,7 +9,7 @@ import { type CursorPageParams } from '../../../pagination';
9
9
 
10
10
  export class Messages extends APIResource {
11
11
  /**
12
- * Get the messages in a stored chat completion. Only chat completions that have
12
+ * Get the messages in a stored chat completion. Only Chat Completions that have
13
13
  * been created with the `store` parameter set to `true` will be returned.
14
14
  */
15
15
  list(
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { Chat, type ChatModel } from './chat';
3
+ export { Chat } from './chat';
4
4
  export {
5
5
  ChatCompletionStoreMessagesPage,
6
6
  ChatCompletionsPage,
@@ -25,7 +25,6 @@ export {
25
25
  type ChatCompletionModality,
26
26
  type ChatCompletionNamedToolChoice,
27
27
  type ChatCompletionPredictionContent,
28
- type ChatCompletionReasoningEffort,
29
28
  type ChatCompletionRole,
30
29
  type ChatCompletionStoreMessage,
31
30
  type ChatCompletionStreamOptions,
@@ -186,16 +186,12 @@ export interface FileObject {
186
186
  }
187
187
 
188
188
  /**
189
- * The intended purpose of the uploaded file.
190
- *
191
- * Use "assistants" for
192
- * [Assistants](https://platform.openai.com/docs/api-reference/assistants) and
193
- * [Message](https://platform.openai.com/docs/api-reference/messages) files,
194
- * "vision" for Assistants image file inputs, "batch" for
195
- * [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for
196
- * [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning).
189
+ * The intended purpose of the uploaded file. One of: - `assistants`: Used in the
190
+ * Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for
191
+ * fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`:
192
+ * Flexible file type for any purpose - `evals`: Used for eval data sets
197
193
  */
198
- export type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision';
194
+ export type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision' | 'user_data' | 'evals';
199
195
 
200
196
  export interface FileCreateParams {
201
197
  /**
@@ -204,14 +200,10 @@ export interface FileCreateParams {
204
200
  file: Core.Uploadable;
205
201
 
206
202
  /**
207
- * The intended purpose of the uploaded file.
208
- *
209
- * Use "assistants" for
210
- * [Assistants](https://platform.openai.com/docs/api-reference/assistants) and
211
- * [Message](https://platform.openai.com/docs/api-reference/messages) files,
212
- * "vision" for Assistants image file inputs, "batch" for
213
- * [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for
214
- * [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning).
203
+ * The intended purpose of the uploaded file. One of: - `assistants`: Used in the
204
+ * Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for
205
+ * fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`:
206
+ * Flexible file type for any purpose - `evals`: Used for eval data sets
215
207
  */
216
208
  purpose: FilePurpose;
217
209
  }
@@ -60,4 +60,24 @@ export {
60
60
  type ModerationCreateResponse,
61
61
  type ModerationCreateParams,
62
62
  } from './moderations';
63
+ export { Responses } from './responses/responses';
63
64
  export { Uploads, type Upload, type UploadCreateParams, type UploadCompleteParams } from './uploads/uploads';
65
+ export {
66
+ VectorStoresPage,
67
+ VectorStoreSearchResponsesPage,
68
+ VectorStores,
69
+ type AutoFileChunkingStrategyParam,
70
+ type FileChunkingStrategy,
71
+ type FileChunkingStrategyParam,
72
+ type OtherFileChunkingStrategyObject,
73
+ type StaticFileChunkingStrategy,
74
+ type StaticFileChunkingStrategyObject,
75
+ type StaticFileChunkingStrategyObjectParam,
76
+ type VectorStore,
77
+ type VectorStoreDeleted,
78
+ type VectorStoreSearchResponse,
79
+ type VectorStoreCreateParams,
80
+ type VectorStoreUpdateParams,
81
+ type VectorStoreListParams,
82
+ type VectorStoreSearchParams,
83
+ } from './vector-stores/vector-stores';