openai 4.86.2 → 4.87.1

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 +16 -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
@@ -0,0 +1,2761 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import {
4
+ type ExtractParsedContentFromParams,
5
+ parseResponse,
6
+ type ResponseCreateParamsWithTools,
7
+ addOutputText,
8
+ } from '../../lib/ResponsesParser';
9
+ import * as Core from '../../core';
10
+ import { APIPromise, isRequestOptions } from '../../core';
11
+ import { APIResource } from '../../resource';
12
+ import { Stream } from '../../streaming';
13
+ import * as Shared from '../shared';
14
+ import * as InputItemsAPI from './input-items';
15
+ import { InputItemListParams, InputItems, ResponseItemList, ResponseItemListDataPage } from './input-items';
16
+ import * as ResponsesAPI from './responses';
17
+ import { ResponseStream, ResponseStreamParams } from '../../lib/responses/ResponseStream';
18
+
19
+ export interface ParsedResponseOutputText<ParsedT> extends ResponseOutputText {
20
+ parsed: ParsedT | null;
21
+ }
22
+
23
+ export type ParsedContent<ParsedT> = ParsedResponseOutputText<ParsedT> | ResponseOutputRefusal;
24
+
25
+ export interface ParsedResponseOutputMessage<ParsedT> extends ResponseOutputMessage {
26
+ content: ParsedContent<ParsedT>[];
27
+ }
28
+
29
+ export interface ParsedResponseFunctionToolCall extends ResponseFunctionToolCall {
30
+ parsed_arguments: any;
31
+ }
32
+
33
+ export type ParsedResponseOutputItem<ParsedT> =
34
+ | ParsedResponseOutputMessage<ParsedT>
35
+ | ParsedResponseFunctionToolCall
36
+ | ResponseFileSearchToolCall
37
+ | ResponseFunctionWebSearch
38
+ | ResponseComputerToolCall
39
+ | ResponseOutputItem.Reasoning;
40
+
41
+ export interface ParsedResponse<ParsedT> extends Response {
42
+ output: Array<ParsedResponseOutputItem<ParsedT>>;
43
+
44
+ output_parsed: ParsedT | null;
45
+ }
46
+
47
+ export type ResponseParseParams = ResponseCreateParamsNonStreaming;
48
+ export class Responses extends APIResource {
49
+ inputItems: InputItemsAPI.InputItems = new InputItemsAPI.InputItems(this._client);
50
+
51
+ /**
52
+ * Creates a model response. Provide
53
+ * [text](https://platform.openai.com/docs/guides/text) or
54
+ * [image](https://platform.openai.com/docs/guides/images) inputs to generate
55
+ * [text](https://platform.openai.com/docs/guides/text) or
56
+ * [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have
57
+ * the model call your own
58
+ * [custom code](https://platform.openai.com/docs/guides/function-calling) or use
59
+ * built-in [tools](https://platform.openai.com/docs/guides/tools) like
60
+ * [web search](https://platform.openai.com/docs/guides/tools-web-search) or
61
+ * [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
62
+ * your own data as input for the model's response.
63
+ */
64
+ create(body: ResponseCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Response>;
65
+ create(
66
+ body: ResponseCreateParamsStreaming,
67
+ options?: Core.RequestOptions,
68
+ ): APIPromise<Stream<ResponseStreamEvent>>;
69
+ create(
70
+ body: ResponseCreateParamsBase,
71
+ options?: Core.RequestOptions,
72
+ ): APIPromise<Stream<ResponseStreamEvent> | Response>;
73
+ create(
74
+ body: ResponseCreateParams,
75
+ options?: Core.RequestOptions,
76
+ ): APIPromise<Response> | APIPromise<Stream<ResponseStreamEvent>> {
77
+ return (
78
+ this._client.post('/responses', { body, ...options, stream: body.stream ?? false }) as
79
+ | APIPromise<Response>
80
+ | APIPromise<Stream<ResponseStreamEvent>>
81
+ )._thenUnwrap((rsp) => {
82
+ if ('type' in rsp && rsp.type === 'response') {
83
+ addOutputText(rsp as Response);
84
+ }
85
+
86
+ return rsp;
87
+ }) as APIPromise<Response> | APIPromise<Stream<ResponseStreamEvent>>;
88
+ }
89
+
90
+ /**
91
+ * Retrieves a model response with the given ID.
92
+ */
93
+ retrieve(
94
+ responseId: string,
95
+ query?: ResponseRetrieveParams,
96
+ options?: Core.RequestOptions,
97
+ ): Core.APIPromise<Response>;
98
+ retrieve(responseId: string, options?: Core.RequestOptions): Core.APIPromise<Response>;
99
+ retrieve(
100
+ responseId: string,
101
+ query: ResponseRetrieveParams | Core.RequestOptions = {},
102
+ options?: Core.RequestOptions,
103
+ ): Core.APIPromise<Response> {
104
+ if (isRequestOptions(query)) {
105
+ return this.retrieve(responseId, {}, query);
106
+ }
107
+ return this._client.get(`/responses/${responseId}`, { query, ...options });
108
+ }
109
+
110
+ /**
111
+ * Deletes a model response with the given ID.
112
+ */
113
+ del(responseId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
114
+ return this._client.delete(`/responses/${responseId}`, {
115
+ ...options,
116
+ headers: { Accept: '*/*', ...options?.headers },
117
+ });
118
+ }
119
+
120
+ parse<Params extends ResponseCreateParamsWithTools, ParsedT = ExtractParsedContentFromParams<Params>>(
121
+ body: Params,
122
+ options?: Core.RequestOptions,
123
+ ): Core.APIPromise<ParsedResponse<ParsedT>> {
124
+ return this._client.responses
125
+ .create(body, options)
126
+ ._thenUnwrap((response) => parseResponse(response as Response, body));
127
+ }
128
+
129
+ /**
130
+ * Creates a chat completion stream
131
+ */
132
+ stream<Params extends ResponseStreamParams, ParsedT = ExtractParsedContentFromParams<Params>>(
133
+ body: Params,
134
+ options?: Core.RequestOptions,
135
+ ): ResponseStream<ParsedT> {
136
+ return ResponseStream.createResponse<ParsedT>(this._client, body, options);
137
+ }
138
+ }
139
+
140
+ /**
141
+ * A tool that controls a virtual computer. Learn more about the
142
+ * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
143
+ */
144
+ export interface ComputerTool {
145
+ /**
146
+ * The height of the computer display.
147
+ */
148
+ display_height: number;
149
+
150
+ /**
151
+ * The width of the computer display.
152
+ */
153
+ display_width: number;
154
+
155
+ /**
156
+ * The type of computer environment to control.
157
+ */
158
+ environment: 'mac' | 'windows' | 'ubuntu' | 'browser';
159
+
160
+ /**
161
+ * The type of the computer use tool. Always `computer_use_preview`.
162
+ */
163
+ type: 'computer-preview';
164
+ }
165
+
166
+ /**
167
+ * A message input to the model with a role indicating instruction following
168
+ * hierarchy. Instructions given with the `developer` or `system` role take
169
+ * precedence over instructions given with the `user` role. Messages with the
170
+ * `assistant` role are presumed to have been generated by the model in previous
171
+ * interactions.
172
+ */
173
+ export interface EasyInputMessage {
174
+ /**
175
+ * Text, image, or audio input to the model, used to generate a response. Can also
176
+ * contain previous assistant responses.
177
+ */
178
+ content: string | ResponseInputMessageContentList;
179
+
180
+ /**
181
+ * The role of the message input. One of `user`, `assistant`, `system`, or
182
+ * `developer`.
183
+ */
184
+ role: 'user' | 'assistant' | 'system' | 'developer';
185
+
186
+ /**
187
+ * The type of the message input. Always `message`.
188
+ */
189
+ type?: 'message';
190
+ }
191
+
192
+ /**
193
+ * A tool that searches for relevant content from uploaded files. Learn more about
194
+ * the
195
+ * [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
196
+ */
197
+ export interface FileSearchTool {
198
+ /**
199
+ * The type of the file search tool. Always `file_search`.
200
+ */
201
+ type: 'file_search';
202
+
203
+ /**
204
+ * The IDs of the vector stores to search.
205
+ */
206
+ vector_store_ids: Array<string>;
207
+
208
+ /**
209
+ * A filter to apply based on file attributes.
210
+ */
211
+ filters?: Shared.ComparisonFilter | Shared.CompoundFilter;
212
+
213
+ /**
214
+ * The maximum number of results to return. This number should be between 1 and 50
215
+ * inclusive.
216
+ */
217
+ max_num_results?: number;
218
+
219
+ /**
220
+ * Ranking options for search.
221
+ */
222
+ ranking_options?: FileSearchTool.RankingOptions;
223
+ }
224
+
225
+ export namespace FileSearchTool {
226
+ /**
227
+ * Ranking options for search.
228
+ */
229
+ export interface RankingOptions {
230
+ /**
231
+ * The ranker to use for the file search.
232
+ */
233
+ ranker?: 'auto' | 'default-2024-11-15';
234
+
235
+ /**
236
+ * The score threshold for the file search, a number between 0 and 1. Numbers
237
+ * closer to 1 will attempt to return only the most relevant results, but may
238
+ * return fewer results.
239
+ */
240
+ score_threshold?: number;
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Defines a function in your own code the model can choose to call. Learn more
246
+ * about
247
+ * [function calling](https://platform.openai.com/docs/guides/function-calling).
248
+ */
249
+ export interface FunctionTool {
250
+ /**
251
+ * The name of the function to call.
252
+ */
253
+ name: string;
254
+
255
+ /**
256
+ * A JSON schema object describing the parameters of the function.
257
+ */
258
+ parameters: Record<string, unknown>;
259
+
260
+ /**
261
+ * Whether to enforce strict parameter validation. Default `true`.
262
+ */
263
+ strict: boolean;
264
+
265
+ /**
266
+ * The type of the function tool. Always `function`.
267
+ */
268
+ type: 'function';
269
+
270
+ /**
271
+ * A description of the function. Used by the model to determine whether or not to
272
+ * call the function.
273
+ */
274
+ description?: string | null;
275
+ }
276
+
277
+ export interface Response {
278
+ /**
279
+ * Unique identifier for this Response.
280
+ */
281
+ id: string;
282
+
283
+ /**
284
+ * Unix timestamp (in seconds) of when this Response was created.
285
+ */
286
+ created_at: number;
287
+
288
+ output_text: string;
289
+
290
+ /**
291
+ * An error object returned when the model fails to generate a Response.
292
+ */
293
+ error: ResponseError | null;
294
+
295
+ /**
296
+ * Details about why the response is incomplete.
297
+ */
298
+ incomplete_details: Response.IncompleteDetails | null;
299
+
300
+ /**
301
+ * Inserts a system (or developer) message as the first item in the model's
302
+ * context.
303
+ *
304
+ * When using along with `previous_response_id`, the instructions from a previous
305
+ * response will be not be carried over to the next response. This makes it simple
306
+ * to swap out system (or developer) messages in new responses.
307
+ */
308
+ instructions: string | null;
309
+
310
+ /**
311
+ * Set of 16 key-value pairs that can be attached to an object. This can be useful
312
+ * for storing additional information about the object in a structured format, and
313
+ * querying for objects via API or the dashboard.
314
+ *
315
+ * Keys are strings with a maximum length of 64 characters. Values are strings with
316
+ * a maximum length of 512 characters.
317
+ */
318
+ metadata: Shared.Metadata | null;
319
+
320
+ /**
321
+ * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a
322
+ * wide range of models with different capabilities, performance characteristics,
323
+ * and price points. Refer to the
324
+ * [model guide](https://platform.openai.com/docs/models) to browse and compare
325
+ * available models.
326
+ */
327
+ model: (string & {}) | Shared.ChatModel;
328
+
329
+ /**
330
+ * The object type of this resource - always set to `response`.
331
+ */
332
+ object: 'response';
333
+
334
+ /**
335
+ * An array of content items generated by the model.
336
+ *
337
+ * - The length and order of items in the `output` array is dependent on the
338
+ * model's response.
339
+ * - Rather than accessing the first item in the `output` array and assuming it's
340
+ * an `assistant` message with the content generated by the model, you might
341
+ * consider using the `output_text` property where supported in SDKs.
342
+ */
343
+ output: Array<ResponseOutputItem>;
344
+
345
+ /**
346
+ * Whether to allow the model to run tool calls in parallel.
347
+ */
348
+ parallel_tool_calls: boolean;
349
+
350
+ /**
351
+ * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
352
+ * make the output more random, while lower values like 0.2 will make it more
353
+ * focused and deterministic. We generally recommend altering this or `top_p` but
354
+ * not both.
355
+ */
356
+ temperature: number | null;
357
+
358
+ /**
359
+ * How the model should select which tool (or tools) to use when generating a
360
+ * response. See the `tools` parameter to see how to specify which tools the model
361
+ * can call.
362
+ */
363
+ tool_choice: ToolChoiceOptions | ToolChoiceTypes | ToolChoiceFunction;
364
+
365
+ /**
366
+ * An array of tools the model may call while generating a response. You can
367
+ * specify which tool to use by setting the `tool_choice` parameter.
368
+ *
369
+ * The two categories of tools you can provide the model are:
370
+ *
371
+ * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
372
+ * capabilities, like
373
+ * [web search](https://platform.openai.com/docs/guides/tools-web-search) or
374
+ * [file search](https://platform.openai.com/docs/guides/tools-file-search).
375
+ * Learn more about
376
+ * [built-in tools](https://platform.openai.com/docs/guides/tools).
377
+ * - **Function calls (custom tools)**: Functions that are defined by you, enabling
378
+ * the model to call your own code. Learn more about
379
+ * [function calling](https://platform.openai.com/docs/guides/function-calling).
380
+ */
381
+ tools: Array<Tool>;
382
+
383
+ /**
384
+ * An alternative to sampling with temperature, called nucleus sampling, where the
385
+ * model considers the results of the tokens with top_p probability mass. So 0.1
386
+ * means only the tokens comprising the top 10% probability mass are considered.
387
+ *
388
+ * We generally recommend altering this or `temperature` but not both.
389
+ */
390
+ top_p: number | null;
391
+
392
+ /**
393
+ * An upper bound for the number of tokens that can be generated for a response,
394
+ * including visible output tokens and
395
+ * [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
396
+ */
397
+ max_output_tokens?: number | null;
398
+
399
+ /**
400
+ * The unique ID of the previous response to the model. Use this to create
401
+ * multi-turn conversations. Learn more about
402
+ * [conversation state](https://platform.openai.com/docs/guides/conversation-state).
403
+ */
404
+ previous_response_id?: string | null;
405
+
406
+ /**
407
+ * **o-series models only**
408
+ *
409
+ * Configuration options for
410
+ * [reasoning models](https://platform.openai.com/docs/guides/reasoning).
411
+ */
412
+ reasoning?: Shared.Reasoning | null;
413
+
414
+ /**
415
+ * The status of the response generation. One of `completed`, `failed`,
416
+ * `in_progress`, or `incomplete`.
417
+ */
418
+ status?: ResponseStatus;
419
+
420
+ /**
421
+ * Configuration options for a text response from the model. Can be plain text or
422
+ * structured JSON data. Learn more:
423
+ *
424
+ * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
425
+ * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
426
+ */
427
+ text?: ResponseTextConfig;
428
+
429
+ /**
430
+ * The truncation strategy to use for the model response.
431
+ *
432
+ * - `auto`: If the context of this response and previous ones exceeds the model's
433
+ * context window size, the model will truncate the response to fit the context
434
+ * window by dropping input items in the middle of the conversation.
435
+ * - `disabled` (default): If a model response will exceed the context window size
436
+ * for a model, the request will fail with a 400 error.
437
+ */
438
+ truncation?: 'auto' | 'disabled' | null;
439
+
440
+ /**
441
+ * Represents token usage details including input tokens, output tokens, a
442
+ * breakdown of output tokens, and the total tokens used.
443
+ */
444
+ usage?: ResponseUsage;
445
+
446
+ /**
447
+ * A unique identifier representing your end-user, which can help OpenAI to monitor
448
+ * and detect abuse.
449
+ * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
450
+ */
451
+ user?: string;
452
+ }
453
+
454
+ export namespace Response {
455
+ /**
456
+ * Details about why the response is incomplete.
457
+ */
458
+ export interface IncompleteDetails {
459
+ /**
460
+ * The reason why the response is incomplete.
461
+ */
462
+ reason?: 'max_output_tokens' | 'content_filter';
463
+ }
464
+ }
465
+
466
+ /**
467
+ * Emitted when there is a partial audio response.
468
+ */
469
+ export interface ResponseAudioDeltaEvent {
470
+ /**
471
+ * A chunk of Base64 encoded response audio bytes.
472
+ */
473
+ delta: string;
474
+
475
+ /**
476
+ * The type of the event. Always `response.audio.delta`.
477
+ */
478
+ type: 'response.audio.delta';
479
+ }
480
+
481
+ /**
482
+ * Emitted when the audio response is complete.
483
+ */
484
+ export interface ResponseAudioDoneEvent {
485
+ /**
486
+ * The type of the event. Always `response.audio.done`.
487
+ */
488
+ type: 'response.audio.done';
489
+ }
490
+
491
+ /**
492
+ * Emitted when there is a partial transcript of audio.
493
+ */
494
+ export interface ResponseAudioTranscriptDeltaEvent {
495
+ /**
496
+ * The partial transcript of the audio response.
497
+ */
498
+ delta: string;
499
+
500
+ /**
501
+ * The type of the event. Always `response.audio.transcript.delta`.
502
+ */
503
+ type: 'response.audio.transcript.delta';
504
+ }
505
+
506
+ /**
507
+ * Emitted when the full audio transcript is completed.
508
+ */
509
+ export interface ResponseAudioTranscriptDoneEvent {
510
+ /**
511
+ * The type of the event. Always `response.audio.transcript.done`.
512
+ */
513
+ type: 'response.audio.transcript.done';
514
+ }
515
+
516
+ /**
517
+ * Emitted when a partial code snippet is added by the code interpreter.
518
+ */
519
+ export interface ResponseCodeInterpreterCallCodeDeltaEvent {
520
+ /**
521
+ * The partial code snippet added by the code interpreter.
522
+ */
523
+ delta: string;
524
+
525
+ /**
526
+ * The index of the output item that the code interpreter call is in progress.
527
+ */
528
+ output_index: number;
529
+
530
+ /**
531
+ * The type of the event. Always `response.code_interpreter_call.code.delta`.
532
+ */
533
+ type: 'response.code_interpreter_call.code.delta';
534
+ }
535
+
536
+ /**
537
+ * Emitted when code snippet output is finalized by the code interpreter.
538
+ */
539
+ export interface ResponseCodeInterpreterCallCodeDoneEvent {
540
+ /**
541
+ * The final code snippet output by the code interpreter.
542
+ */
543
+ code: string;
544
+
545
+ /**
546
+ * The index of the output item that the code interpreter call is in progress.
547
+ */
548
+ output_index: number;
549
+
550
+ /**
551
+ * The type of the event. Always `response.code_interpreter_call.code.done`.
552
+ */
553
+ type: 'response.code_interpreter_call.code.done';
554
+ }
555
+
556
+ /**
557
+ * Emitted when the code interpreter call is completed.
558
+ */
559
+ export interface ResponseCodeInterpreterCallCompletedEvent {
560
+ /**
561
+ * A tool call to run code.
562
+ */
563
+ code_interpreter_call: ResponseCodeInterpreterToolCall;
564
+
565
+ /**
566
+ * The index of the output item that the code interpreter call is in progress.
567
+ */
568
+ output_index: number;
569
+
570
+ /**
571
+ * The type of the event. Always `response.code_interpreter_call.completed`.
572
+ */
573
+ type: 'response.code_interpreter_call.completed';
574
+ }
575
+
576
+ /**
577
+ * Emitted when a code interpreter call is in progress.
578
+ */
579
+ export interface ResponseCodeInterpreterCallInProgressEvent {
580
+ /**
581
+ * A tool call to run code.
582
+ */
583
+ code_interpreter_call: ResponseCodeInterpreterToolCall;
584
+
585
+ /**
586
+ * The index of the output item that the code interpreter call is in progress.
587
+ */
588
+ output_index: number;
589
+
590
+ /**
591
+ * The type of the event. Always `response.code_interpreter_call.in_progress`.
592
+ */
593
+ type: 'response.code_interpreter_call.in_progress';
594
+ }
595
+
596
+ /**
597
+ * Emitted when the code interpreter is actively interpreting the code snippet.
598
+ */
599
+ export interface ResponseCodeInterpreterCallInterpretingEvent {
600
+ /**
601
+ * A tool call to run code.
602
+ */
603
+ code_interpreter_call: ResponseCodeInterpreterToolCall;
604
+
605
+ /**
606
+ * The index of the output item that the code interpreter call is in progress.
607
+ */
608
+ output_index: number;
609
+
610
+ /**
611
+ * The type of the event. Always `response.code_interpreter_call.interpreting`.
612
+ */
613
+ type: 'response.code_interpreter_call.interpreting';
614
+ }
615
+
616
+ /**
617
+ * A tool call to run code.
618
+ */
619
+ export interface ResponseCodeInterpreterToolCall {
620
+ /**
621
+ * The unique ID of the code interpreter tool call.
622
+ */
623
+ id: string;
624
+
625
+ /**
626
+ * The code to run.
627
+ */
628
+ code: string;
629
+
630
+ /**
631
+ * The results of the code interpreter tool call.
632
+ */
633
+ results: Array<ResponseCodeInterpreterToolCall.Logs | ResponseCodeInterpreterToolCall.Files>;
634
+
635
+ /**
636
+ * The status of the code interpreter tool call.
637
+ */
638
+ status: 'in_progress' | 'interpreting' | 'completed';
639
+
640
+ /**
641
+ * The type of the code interpreter tool call. Always `code_interpreter_call`.
642
+ */
643
+ type: 'code_interpreter_call';
644
+ }
645
+
646
+ export namespace ResponseCodeInterpreterToolCall {
647
+ /**
648
+ * The output of a code interpreter tool call that is text.
649
+ */
650
+ export interface Logs {
651
+ /**
652
+ * The logs of the code interpreter tool call.
653
+ */
654
+ logs: string;
655
+
656
+ /**
657
+ * The type of the code interpreter text output. Always `logs`.
658
+ */
659
+ type: 'logs';
660
+ }
661
+
662
+ /**
663
+ * The output of a code interpreter tool call that is a file.
664
+ */
665
+ export interface Files {
666
+ files: Array<Files.File>;
667
+
668
+ /**
669
+ * The type of the code interpreter file output. Always `files`.
670
+ */
671
+ type: 'files';
672
+ }
673
+
674
+ export namespace Files {
675
+ export interface File {
676
+ /**
677
+ * The ID of the file.
678
+ */
679
+ file_id: string;
680
+
681
+ /**
682
+ * The MIME type of the file.
683
+ */
684
+ mime_type: string;
685
+ }
686
+ }
687
+ }
688
+
689
+ /**
690
+ * Emitted when the model response is complete.
691
+ */
692
+ export interface ResponseCompletedEvent {
693
+ /**
694
+ * Properties of the completed response.
695
+ */
696
+ response: Response;
697
+
698
+ /**
699
+ * The type of the event. Always `response.completed`.
700
+ */
701
+ type: 'response.completed';
702
+ }
703
+
704
+ /**
705
+ * A tool call to a computer use tool. See the
706
+ * [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use)
707
+ * for more information.
708
+ */
709
+ export interface ResponseComputerToolCall {
710
+ /**
711
+ * The unique ID of the computer call.
712
+ */
713
+ id: string;
714
+
715
+ /**
716
+ * A click action.
717
+ */
718
+ action:
719
+ | ResponseComputerToolCall.Click
720
+ | ResponseComputerToolCall.DoubleClick
721
+ | ResponseComputerToolCall.Drag
722
+ | ResponseComputerToolCall.Keypress
723
+ | ResponseComputerToolCall.Move
724
+ | ResponseComputerToolCall.Screenshot
725
+ | ResponseComputerToolCall.Scroll
726
+ | ResponseComputerToolCall.Type
727
+ | ResponseComputerToolCall.Wait;
728
+
729
+ /**
730
+ * An identifier used when responding to the tool call with output.
731
+ */
732
+ call_id: string;
733
+
734
+ /**
735
+ * The pending safety checks for the computer call.
736
+ */
737
+ pending_safety_checks: Array<ResponseComputerToolCall.PendingSafetyCheck>;
738
+
739
+ /**
740
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
741
+ * Populated when items are returned via API.
742
+ */
743
+ status: 'in_progress' | 'completed' | 'incomplete';
744
+
745
+ /**
746
+ * The type of the computer call. Always `computer_call`.
747
+ */
748
+ type: 'computer_call';
749
+ }
750
+
751
+ export namespace ResponseComputerToolCall {
752
+ /**
753
+ * A click action.
754
+ */
755
+ export interface Click {
756
+ /**
757
+ * Indicates which mouse button was pressed during the click. One of `left`,
758
+ * `right`, `wheel`, `back`, or `forward`.
759
+ */
760
+ button: 'left' | 'right' | 'wheel' | 'back' | 'forward';
761
+
762
+ /**
763
+ * Specifies the event type. For a click action, this property is always set to
764
+ * `click`.
765
+ */
766
+ type: 'click';
767
+
768
+ /**
769
+ * The x-coordinate where the click occurred.
770
+ */
771
+ x: number;
772
+
773
+ /**
774
+ * The y-coordinate where the click occurred.
775
+ */
776
+ y: number;
777
+ }
778
+
779
+ /**
780
+ * A double click action.
781
+ */
782
+ export interface DoubleClick {
783
+ /**
784
+ * Specifies the event type. For a double click action, this property is always set
785
+ * to `double_click`.
786
+ */
787
+ type: 'double_click';
788
+
789
+ /**
790
+ * The x-coordinate where the double click occurred.
791
+ */
792
+ x: number;
793
+
794
+ /**
795
+ * The y-coordinate where the double click occurred.
796
+ */
797
+ y: number;
798
+ }
799
+
800
+ /**
801
+ * A drag action.
802
+ */
803
+ export interface Drag {
804
+ /**
805
+ * An array of coordinates representing the path of the drag action. Coordinates
806
+ * will appear as an array of objects, eg
807
+ *
808
+ * ```
809
+ * [
810
+ * { x: 100, y: 200 },
811
+ * { x: 200, y: 300 }
812
+ * ]
813
+ * ```
814
+ */
815
+ path: Array<Drag.Path>;
816
+
817
+ /**
818
+ * Specifies the event type. For a drag action, this property is always set to
819
+ * `drag`.
820
+ */
821
+ type: 'drag';
822
+ }
823
+
824
+ export namespace Drag {
825
+ /**
826
+ * A series of x/y coordinate pairs in the drag path.
827
+ */
828
+ export interface Path {
829
+ /**
830
+ * The x-coordinate.
831
+ */
832
+ x: number;
833
+
834
+ /**
835
+ * The y-coordinate.
836
+ */
837
+ y: number;
838
+ }
839
+ }
840
+
841
+ /**
842
+ * A collection of keypresses the model would like to perform.
843
+ */
844
+ export interface Keypress {
845
+ /**
846
+ * The combination of keys the model is requesting to be pressed. This is an array
847
+ * of strings, each representing a key.
848
+ */
849
+ keys: Array<string>;
850
+
851
+ /**
852
+ * Specifies the event type. For a keypress action, this property is always set to
853
+ * `keypress`.
854
+ */
855
+ type: 'keypress';
856
+ }
857
+
858
+ /**
859
+ * A mouse move action.
860
+ */
861
+ export interface Move {
862
+ /**
863
+ * Specifies the event type. For a move action, this property is always set to
864
+ * `move`.
865
+ */
866
+ type: 'move';
867
+
868
+ /**
869
+ * The x-coordinate to move to.
870
+ */
871
+ x: number;
872
+
873
+ /**
874
+ * The y-coordinate to move to.
875
+ */
876
+ y: number;
877
+ }
878
+
879
+ /**
880
+ * A screenshot action.
881
+ */
882
+ export interface Screenshot {
883
+ /**
884
+ * Specifies the event type. For a screenshot action, this property is always set
885
+ * to `screenshot`.
886
+ */
887
+ type: 'screenshot';
888
+ }
889
+
890
+ /**
891
+ * A scroll action.
892
+ */
893
+ export interface Scroll {
894
+ /**
895
+ * The horizontal scroll distance.
896
+ */
897
+ scroll_x: number;
898
+
899
+ /**
900
+ * The vertical scroll distance.
901
+ */
902
+ scroll_y: number;
903
+
904
+ /**
905
+ * Specifies the event type. For a scroll action, this property is always set to
906
+ * `scroll`.
907
+ */
908
+ type: 'scroll';
909
+
910
+ /**
911
+ * The x-coordinate where the scroll occurred.
912
+ */
913
+ x: number;
914
+
915
+ /**
916
+ * The y-coordinate where the scroll occurred.
917
+ */
918
+ y: number;
919
+ }
920
+
921
+ /**
922
+ * An action to type in text.
923
+ */
924
+ export interface Type {
925
+ /**
926
+ * The text to type.
927
+ */
928
+ text: string;
929
+
930
+ /**
931
+ * Specifies the event type. For a type action, this property is always set to
932
+ * `type`.
933
+ */
934
+ type: 'type';
935
+ }
936
+
937
+ /**
938
+ * A wait action.
939
+ */
940
+ export interface Wait {
941
+ /**
942
+ * Specifies the event type. For a wait action, this property is always set to
943
+ * `wait`.
944
+ */
945
+ type: 'wait';
946
+ }
947
+
948
+ /**
949
+ * A pending safety check for the computer call.
950
+ */
951
+ export interface PendingSafetyCheck {
952
+ /**
953
+ * The ID of the pending safety check.
954
+ */
955
+ id: string;
956
+
957
+ /**
958
+ * The type of the pending safety check.
959
+ */
960
+ code: string;
961
+
962
+ /**
963
+ * Details about the pending safety check.
964
+ */
965
+ message: string;
966
+ }
967
+ }
968
+
969
+ /**
970
+ * Multi-modal input and output contents.
971
+ */
972
+ export type ResponseContent =
973
+ | ResponseInputText
974
+ | ResponseInputImage
975
+ | ResponseInputFile
976
+ | ResponseOutputText
977
+ | ResponseOutputRefusal;
978
+
979
+ /**
980
+ * Emitted when a new content part is added.
981
+ */
982
+ export interface ResponseContentPartAddedEvent {
983
+ /**
984
+ * The index of the content part that was added.
985
+ */
986
+ content_index: number;
987
+
988
+ /**
989
+ * The ID of the output item that the content part was added to.
990
+ */
991
+ item_id: string;
992
+
993
+ /**
994
+ * The index of the output item that the content part was added to.
995
+ */
996
+ output_index: number;
997
+
998
+ /**
999
+ * The content part that was added.
1000
+ */
1001
+ part: ResponseOutputText | ResponseOutputRefusal;
1002
+
1003
+ /**
1004
+ * The type of the event. Always `response.content_part.added`.
1005
+ */
1006
+ type: 'response.content_part.added';
1007
+ }
1008
+
1009
+ /**
1010
+ * Emitted when a content part is done.
1011
+ */
1012
+ export interface ResponseContentPartDoneEvent {
1013
+ /**
1014
+ * The index of the content part that is done.
1015
+ */
1016
+ content_index: number;
1017
+
1018
+ /**
1019
+ * The ID of the output item that the content part was added to.
1020
+ */
1021
+ item_id: string;
1022
+
1023
+ /**
1024
+ * The index of the output item that the content part was added to.
1025
+ */
1026
+ output_index: number;
1027
+
1028
+ /**
1029
+ * The content part that is done.
1030
+ */
1031
+ part: ResponseOutputText | ResponseOutputRefusal;
1032
+
1033
+ /**
1034
+ * The type of the event. Always `response.content_part.done`.
1035
+ */
1036
+ type: 'response.content_part.done';
1037
+ }
1038
+
1039
+ /**
1040
+ * An event that is emitted when a response is created.
1041
+ */
1042
+ export interface ResponseCreatedEvent {
1043
+ /**
1044
+ * The response that was created.
1045
+ */
1046
+ response: Response;
1047
+
1048
+ /**
1049
+ * The type of the event. Always `response.created`.
1050
+ */
1051
+ type: 'response.created';
1052
+ }
1053
+
1054
+ /**
1055
+ * An error object returned when the model fails to generate a Response.
1056
+ */
1057
+ export interface ResponseError {
1058
+ /**
1059
+ * The error code for the response.
1060
+ */
1061
+ code:
1062
+ | 'server_error'
1063
+ | 'rate_limit_exceeded'
1064
+ | 'invalid_prompt'
1065
+ | 'vector_store_timeout'
1066
+ | 'invalid_image'
1067
+ | 'invalid_image_format'
1068
+ | 'invalid_base64_image'
1069
+ | 'invalid_image_url'
1070
+ | 'image_too_large'
1071
+ | 'image_too_small'
1072
+ | 'image_parse_error'
1073
+ | 'image_content_policy_violation'
1074
+ | 'invalid_image_mode'
1075
+ | 'image_file_too_large'
1076
+ | 'unsupported_image_media_type'
1077
+ | 'empty_image_file'
1078
+ | 'failed_to_download_image'
1079
+ | 'image_file_not_found';
1080
+
1081
+ /**
1082
+ * A human-readable description of the error.
1083
+ */
1084
+ message: string;
1085
+ }
1086
+
1087
+ /**
1088
+ * Emitted when an error occurs.
1089
+ */
1090
+ export interface ResponseErrorEvent {
1091
+ /**
1092
+ * The error code.
1093
+ */
1094
+ code: string | null;
1095
+
1096
+ /**
1097
+ * The error message.
1098
+ */
1099
+ message: string;
1100
+
1101
+ /**
1102
+ * The error parameter.
1103
+ */
1104
+ param: string | null;
1105
+
1106
+ /**
1107
+ * The type of the event. Always `error`.
1108
+ */
1109
+ type: 'error';
1110
+ }
1111
+
1112
+ /**
1113
+ * An event that is emitted when a response fails.
1114
+ */
1115
+ export interface ResponseFailedEvent {
1116
+ /**
1117
+ * The response that failed.
1118
+ */
1119
+ response: Response;
1120
+
1121
+ /**
1122
+ * The type of the event. Always `response.failed`.
1123
+ */
1124
+ type: 'response.failed';
1125
+ }
1126
+
1127
+ /**
1128
+ * Emitted when a file search call is completed (results found).
1129
+ */
1130
+ export interface ResponseFileSearchCallCompletedEvent {
1131
+ /**
1132
+ * The ID of the output item that the file search call is initiated.
1133
+ */
1134
+ item_id: string;
1135
+
1136
+ /**
1137
+ * The index of the output item that the file search call is initiated.
1138
+ */
1139
+ output_index: number;
1140
+
1141
+ /**
1142
+ * The type of the event. Always `response.file_search_call.completed`.
1143
+ */
1144
+ type: 'response.file_search_call.completed';
1145
+ }
1146
+
1147
+ /**
1148
+ * Emitted when a file search call is initiated.
1149
+ */
1150
+ export interface ResponseFileSearchCallInProgressEvent {
1151
+ /**
1152
+ * The ID of the output item that the file search call is initiated.
1153
+ */
1154
+ item_id: string;
1155
+
1156
+ /**
1157
+ * The index of the output item that the file search call is initiated.
1158
+ */
1159
+ output_index: number;
1160
+
1161
+ /**
1162
+ * The type of the event. Always `response.file_search_call.in_progress`.
1163
+ */
1164
+ type: 'response.file_search_call.in_progress';
1165
+ }
1166
+
1167
+ /**
1168
+ * Emitted when a file search is currently searching.
1169
+ */
1170
+ export interface ResponseFileSearchCallSearchingEvent {
1171
+ /**
1172
+ * The ID of the output item that the file search call is initiated.
1173
+ */
1174
+ item_id: string;
1175
+
1176
+ /**
1177
+ * The index of the output item that the file search call is searching.
1178
+ */
1179
+ output_index: number;
1180
+
1181
+ /**
1182
+ * The type of the event. Always `response.file_search_call.searching`.
1183
+ */
1184
+ type: 'response.file_search_call.searching';
1185
+ }
1186
+
1187
+ /**
1188
+ * The results of a file search tool call. See the
1189
+ * [file search guide](https://platform.openai.com/docs/guides/tools-file-search)
1190
+ * for more information.
1191
+ */
1192
+ export interface ResponseFileSearchToolCall {
1193
+ /**
1194
+ * The unique ID of the file search tool call.
1195
+ */
1196
+ id: string;
1197
+
1198
+ /**
1199
+ * The queries used to search for files.
1200
+ */
1201
+ queries: Array<string>;
1202
+
1203
+ /**
1204
+ * The status of the file search tool call. One of `in_progress`, `searching`,
1205
+ * `incomplete` or `failed`,
1206
+ */
1207
+ status: 'in_progress' | 'searching' | 'completed' | 'incomplete' | 'failed';
1208
+
1209
+ /**
1210
+ * The type of the file search tool call. Always `file_search_call`.
1211
+ */
1212
+ type: 'file_search_call';
1213
+
1214
+ /**
1215
+ * The results of the file search tool call.
1216
+ */
1217
+ results?: Array<ResponseFileSearchToolCall.Result> | null;
1218
+ }
1219
+
1220
+ export namespace ResponseFileSearchToolCall {
1221
+ export interface Result {
1222
+ /**
1223
+ * Set of 16 key-value pairs that can be attached to an object. This can be useful
1224
+ * for storing additional information about the object in a structured format, and
1225
+ * querying for objects via API or the dashboard. Keys are strings with a maximum
1226
+ * length of 64 characters. Values are strings with a maximum length of 512
1227
+ * characters, booleans, or numbers.
1228
+ */
1229
+ attributes?: Record<string, string | number | boolean> | null;
1230
+
1231
+ /**
1232
+ * The unique ID of the file.
1233
+ */
1234
+ file_id?: string;
1235
+
1236
+ /**
1237
+ * The name of the file.
1238
+ */
1239
+ filename?: string;
1240
+
1241
+ /**
1242
+ * The relevance score of the file - a value between 0 and 1.
1243
+ */
1244
+ score?: number;
1245
+
1246
+ /**
1247
+ * The text that was retrieved from the file.
1248
+ */
1249
+ text?: string;
1250
+ }
1251
+ }
1252
+
1253
+ /**
1254
+ * An object specifying the format that the model must output.
1255
+ *
1256
+ * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
1257
+ * ensures the model will match your supplied JSON schema. Learn more in the
1258
+ * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
1259
+ *
1260
+ * The default format is `{ "type": "text" }` with no additional options.
1261
+ *
1262
+ * **Not recommended for gpt-4o and newer models:**
1263
+ *
1264
+ * Setting to `{ "type": "json_object" }` enables the older JSON mode, which
1265
+ * ensures the message the model generates is valid JSON. Using `json_schema` is
1266
+ * preferred for models that support it.
1267
+ */
1268
+ export type ResponseFormatTextConfig =
1269
+ | Shared.ResponseFormatText
1270
+ | ResponseFormatTextJSONSchemaConfig
1271
+ | Shared.ResponseFormatJSONObject;
1272
+
1273
+ /**
1274
+ * JSON Schema response format. Used to generate structured JSON responses. Learn
1275
+ * more about
1276
+ * [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
1277
+ */
1278
+ export interface ResponseFormatTextJSONSchemaConfig {
1279
+ /**
1280
+ * The schema for the response format, described as a JSON Schema object. Learn how
1281
+ * to build JSON schemas [here](https://json-schema.org/).
1282
+ */
1283
+ schema: Record<string, unknown>;
1284
+
1285
+ /**
1286
+ * The type of response format being defined. Always `json_schema`.
1287
+ */
1288
+ type: 'json_schema';
1289
+
1290
+ /**
1291
+ * A description of what the response format is for, used by the model to determine
1292
+ * how to respond in the format.
1293
+ */
1294
+ description?: string;
1295
+
1296
+ /**
1297
+ * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
1298
+ * and dashes, with a maximum length of 64.
1299
+ */
1300
+ name?: string;
1301
+
1302
+ /**
1303
+ * Whether to enable strict schema adherence when generating the output. If set to
1304
+ * true, the model will always follow the exact schema defined in the `schema`
1305
+ * field. Only a subset of JSON Schema is supported when `strict` is `true`. To
1306
+ * learn more, read the
1307
+ * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
1308
+ */
1309
+ strict?: boolean | null;
1310
+ }
1311
+
1312
+ /**
1313
+ * Emitted when there is a partial function-call arguments delta.
1314
+ */
1315
+ export interface ResponseFunctionCallArgumentsDeltaEvent {
1316
+ /**
1317
+ * The function-call arguments delta that is added.
1318
+ */
1319
+ delta: string;
1320
+
1321
+ /**
1322
+ * The ID of the output item that the function-call arguments delta is added to.
1323
+ */
1324
+ item_id: string;
1325
+
1326
+ /**
1327
+ * The index of the output item that the function-call arguments delta is added to.
1328
+ */
1329
+ output_index: number;
1330
+
1331
+ /**
1332
+ * The type of the event. Always `response.function_call_arguments.delta`.
1333
+ */
1334
+ type: 'response.function_call_arguments.delta';
1335
+ }
1336
+
1337
+ /**
1338
+ * Emitted when function-call arguments are finalized.
1339
+ */
1340
+ export interface ResponseFunctionCallArgumentsDoneEvent {
1341
+ /**
1342
+ * The function-call arguments.
1343
+ */
1344
+ arguments: string;
1345
+
1346
+ /**
1347
+ * The ID of the item.
1348
+ */
1349
+ item_id: string;
1350
+
1351
+ /**
1352
+ * The index of the output item.
1353
+ */
1354
+ output_index: number;
1355
+
1356
+ type: 'response.function_call_arguments.done';
1357
+ }
1358
+
1359
+ /**
1360
+ * A tool call to run a function. See the
1361
+ * [function calling guide](https://platform.openai.com/docs/guides/function-calling)
1362
+ * for more information.
1363
+ */
1364
+ export interface ResponseFunctionToolCall {
1365
+ /**
1366
+ * The unique ID of the function tool call.
1367
+ */
1368
+ id: string;
1369
+
1370
+ /**
1371
+ * A JSON string of the arguments to pass to the function.
1372
+ */
1373
+ arguments: string;
1374
+
1375
+ /**
1376
+ * The unique ID of the function tool call generated by the model.
1377
+ */
1378
+ call_id: string;
1379
+
1380
+ /**
1381
+ * The name of the function to run.
1382
+ */
1383
+ name: string;
1384
+
1385
+ /**
1386
+ * The type of the function tool call. Always `function_call`.
1387
+ */
1388
+ type: 'function_call';
1389
+
1390
+ /**
1391
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1392
+ * Populated when items are returned via API.
1393
+ */
1394
+ status?: 'in_progress' | 'completed' | 'incomplete';
1395
+ }
1396
+
1397
+ /**
1398
+ * The results of a web search tool call. See the
1399
+ * [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for
1400
+ * more information.
1401
+ */
1402
+ export interface ResponseFunctionWebSearch {
1403
+ /**
1404
+ * The unique ID of the web search tool call.
1405
+ */
1406
+ id: string;
1407
+
1408
+ /**
1409
+ * The status of the web search tool call.
1410
+ */
1411
+ status: 'in_progress' | 'searching' | 'completed' | 'failed';
1412
+
1413
+ /**
1414
+ * The type of the web search tool call. Always `web_search_call`.
1415
+ */
1416
+ type: 'web_search_call';
1417
+ }
1418
+
1419
+ /**
1420
+ * Emitted when the response is in progress.
1421
+ */
1422
+ export interface ResponseInProgressEvent {
1423
+ /**
1424
+ * The response that is in progress.
1425
+ */
1426
+ response: Response;
1427
+
1428
+ /**
1429
+ * The type of the event. Always `response.in_progress`.
1430
+ */
1431
+ type: 'response.in_progress';
1432
+ }
1433
+
1434
+ /**
1435
+ * Specify additional output data to include in the model response. Currently
1436
+ * supported values are:
1437
+ *
1438
+ * - `file_search_call.results`: Include the search results of the file search tool
1439
+ * call.
1440
+ * - `message.input_image.image_url`: Include image urls from the input message.
1441
+ * - `computer_call_output.output.image_url`: Include image urls from the computer
1442
+ * call output.
1443
+ */
1444
+ export type ResponseIncludable =
1445
+ | 'file_search_call.results'
1446
+ | 'message.input_image.image_url'
1447
+ | 'computer_call_output.output.image_url';
1448
+
1449
+ /**
1450
+ * An event that is emitted when a response finishes as incomplete.
1451
+ */
1452
+ export interface ResponseIncompleteEvent {
1453
+ /**
1454
+ * The response that was incomplete.
1455
+ */
1456
+ response: Response;
1457
+
1458
+ /**
1459
+ * The type of the event. Always `response.incomplete`.
1460
+ */
1461
+ type: 'response.incomplete';
1462
+ }
1463
+
1464
+ /**
1465
+ * A list of one or many input items to the model, containing different content
1466
+ * types.
1467
+ */
1468
+ export type ResponseInput = Array<ResponseInputItem>;
1469
+
1470
+ /**
1471
+ * An audio input to the model.
1472
+ */
1473
+ export interface ResponseInputAudio {
1474
+ /**
1475
+ * Base64-encoded audio data.
1476
+ */
1477
+ data: string;
1478
+
1479
+ /**
1480
+ * The format of the audio data. Currently supported formats are `mp3` and `wav`.
1481
+ */
1482
+ format: 'mp3' | 'wav';
1483
+
1484
+ /**
1485
+ * The type of the input item. Always `input_audio`.
1486
+ */
1487
+ type: 'input_audio';
1488
+ }
1489
+
1490
+ /**
1491
+ * A text input to the model.
1492
+ */
1493
+ export type ResponseInputContent = ResponseInputText | ResponseInputImage | ResponseInputFile;
1494
+
1495
+ /**
1496
+ * A file input to the model.
1497
+ */
1498
+ export interface ResponseInputFile {
1499
+ /**
1500
+ * The type of the input item. Always `input_file`.
1501
+ */
1502
+ type: 'input_file';
1503
+
1504
+ /**
1505
+ * The content of the file to be sent to the model.
1506
+ */
1507
+ file_data?: string;
1508
+
1509
+ /**
1510
+ * The ID of the file to be sent to the model.
1511
+ */
1512
+ file_id?: string;
1513
+
1514
+ /**
1515
+ * The name of the file to be sent to the model.
1516
+ */
1517
+ filename?: string;
1518
+ }
1519
+
1520
+ /**
1521
+ * An image input to the model. Learn about
1522
+ * [image inputs](https://platform.openai.com/docs/guides/vision).
1523
+ */
1524
+ export interface ResponseInputImage {
1525
+ /**
1526
+ * The detail level of the image to be sent to the model. One of `high`, `low`, or
1527
+ * `auto`. Defaults to `auto`.
1528
+ */
1529
+ detail: 'high' | 'low' | 'auto';
1530
+
1531
+ /**
1532
+ * The type of the input item. Always `input_image`.
1533
+ */
1534
+ type: 'input_image';
1535
+
1536
+ /**
1537
+ * The ID of the file to be sent to the model.
1538
+ */
1539
+ file_id?: string | null;
1540
+
1541
+ /**
1542
+ * The URL of the image to be sent to the model. A fully qualified URL or base64
1543
+ * encoded image in a data URL.
1544
+ */
1545
+ image_url?: string | null;
1546
+ }
1547
+
1548
+ /**
1549
+ * A message input to the model with a role indicating instruction following
1550
+ * hierarchy. Instructions given with the `developer` or `system` role take
1551
+ * precedence over instructions given with the `user` role. Messages with the
1552
+ * `assistant` role are presumed to have been generated by the model in previous
1553
+ * interactions.
1554
+ */
1555
+ export type ResponseInputItem =
1556
+ | EasyInputMessage
1557
+ | ResponseInputItem.Message
1558
+ | ResponseOutputMessage
1559
+ | ResponseFileSearchToolCall
1560
+ | ResponseComputerToolCall
1561
+ | ResponseInputItem.ComputerCallOutput
1562
+ | ResponseFunctionWebSearch
1563
+ | ResponseFunctionToolCall
1564
+ | ResponseInputItem.FunctionCallOutput
1565
+ | ResponseInputItem.Reasoning
1566
+ | ResponseInputItem.ItemReference;
1567
+
1568
+ export namespace ResponseInputItem {
1569
+ /**
1570
+ * A message input to the model with a role indicating instruction following
1571
+ * hierarchy. Instructions given with the `developer` or `system` role take
1572
+ * precedence over instructions given with the `user` role.
1573
+ */
1574
+ export interface Message {
1575
+ /**
1576
+ * A list of one or many input items to the model, containing different content
1577
+ * types.
1578
+ */
1579
+ content: ResponsesAPI.ResponseInputMessageContentList;
1580
+
1581
+ /**
1582
+ * The role of the message input. One of `user`, `system`, or `developer`.
1583
+ */
1584
+ role: 'user' | 'system' | 'developer';
1585
+
1586
+ /**
1587
+ * The status of item. One of `in_progress`, `completed`, or `incomplete`.
1588
+ * Populated when items are returned via API.
1589
+ */
1590
+ status?: 'in_progress' | 'completed' | 'incomplete';
1591
+
1592
+ /**
1593
+ * The type of the message input. Always set to `message`.
1594
+ */
1595
+ type?: 'message';
1596
+ }
1597
+
1598
+ /**
1599
+ * The output of a computer tool call.
1600
+ */
1601
+ export interface ComputerCallOutput {
1602
+ /**
1603
+ * The ID of the computer tool call that produced the output.
1604
+ */
1605
+ call_id: string;
1606
+
1607
+ /**
1608
+ * A computer screenshot image used with the computer use tool.
1609
+ */
1610
+ output: ComputerCallOutput.Output;
1611
+
1612
+ /**
1613
+ * The type of the computer tool call output. Always `computer_call_output`.
1614
+ */
1615
+ type: 'computer_call_output';
1616
+
1617
+ /**
1618
+ * The ID of the computer tool call output.
1619
+ */
1620
+ id?: string;
1621
+
1622
+ /**
1623
+ * The safety checks reported by the API that have been acknowledged by the
1624
+ * developer.
1625
+ */
1626
+ acknowledged_safety_checks?: Array<ComputerCallOutput.AcknowledgedSafetyCheck>;
1627
+
1628
+ /**
1629
+ * The status of the message input. One of `in_progress`, `completed`, or
1630
+ * `incomplete`. Populated when input items are returned via API.
1631
+ */
1632
+ status?: 'in_progress' | 'completed' | 'incomplete';
1633
+ }
1634
+
1635
+ export namespace ComputerCallOutput {
1636
+ /**
1637
+ * A computer screenshot image used with the computer use tool.
1638
+ */
1639
+ export interface Output {
1640
+ /**
1641
+ * Specifies the event type. For a computer screenshot, this property is always set
1642
+ * to `computer_screenshot`.
1643
+ */
1644
+ type: 'computer_screenshot';
1645
+
1646
+ /**
1647
+ * The identifier of an uploaded file that contains the screenshot.
1648
+ */
1649
+ file_id?: string;
1650
+
1651
+ /**
1652
+ * The URL of the screenshot image.
1653
+ */
1654
+ image_url?: string;
1655
+ }
1656
+
1657
+ /**
1658
+ * A pending safety check for the computer call.
1659
+ */
1660
+ export interface AcknowledgedSafetyCheck {
1661
+ /**
1662
+ * The ID of the pending safety check.
1663
+ */
1664
+ id: string;
1665
+
1666
+ /**
1667
+ * The type of the pending safety check.
1668
+ */
1669
+ code: string;
1670
+
1671
+ /**
1672
+ * Details about the pending safety check.
1673
+ */
1674
+ message: string;
1675
+ }
1676
+ }
1677
+
1678
+ /**
1679
+ * The output of a function tool call.
1680
+ */
1681
+ export interface FunctionCallOutput {
1682
+ /**
1683
+ * The unique ID of the function tool call generated by the model.
1684
+ */
1685
+ call_id: string;
1686
+
1687
+ /**
1688
+ * A JSON string of the output of the function tool call.
1689
+ */
1690
+ output: string;
1691
+
1692
+ /**
1693
+ * The type of the function tool call output. Always `function_call_output`.
1694
+ */
1695
+ type: 'function_call_output';
1696
+
1697
+ /**
1698
+ * The unique ID of the function tool call output. Populated when this item is
1699
+ * returned via API.
1700
+ */
1701
+ id?: string;
1702
+
1703
+ /**
1704
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1705
+ * Populated when items are returned via API.
1706
+ */
1707
+ status?: 'in_progress' | 'completed' | 'incomplete';
1708
+ }
1709
+
1710
+ /**
1711
+ * A description of the chain of thought used by a reasoning model while generating
1712
+ * a response.
1713
+ */
1714
+ export interface Reasoning {
1715
+ /**
1716
+ * The unique identifier of the reasoning content.
1717
+ */
1718
+ id: string;
1719
+
1720
+ /**
1721
+ * Reasoning text contents.
1722
+ */
1723
+ content: Array<Reasoning.Content>;
1724
+
1725
+ /**
1726
+ * The type of the object. Always `reasoning`.
1727
+ */
1728
+ type: 'reasoning';
1729
+
1730
+ /**
1731
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1732
+ * Populated when items are returned via API.
1733
+ */
1734
+ status?: 'in_progress' | 'completed' | 'incomplete';
1735
+ }
1736
+
1737
+ export namespace Reasoning {
1738
+ export interface Content {
1739
+ /**
1740
+ * A short summary of the reasoning used by the model when generating the response.
1741
+ */
1742
+ text: string;
1743
+
1744
+ /**
1745
+ * The type of the object. Always `text`.
1746
+ */
1747
+ type: 'reasoning_summary';
1748
+ }
1749
+ }
1750
+
1751
+ /**
1752
+ * An internal identifier for an item to reference.
1753
+ */
1754
+ export interface ItemReference {
1755
+ /**
1756
+ * The ID of the item to reference.
1757
+ */
1758
+ id: string;
1759
+
1760
+ /**
1761
+ * The type of item to reference. Always `item_reference`.
1762
+ */
1763
+ type: 'item_reference';
1764
+ }
1765
+ }
1766
+
1767
+ /**
1768
+ * A list of one or many input items to the model, containing different content
1769
+ * types.
1770
+ */
1771
+ export type ResponseInputMessageContentList = Array<ResponseInputContent>;
1772
+
1773
+ /**
1774
+ * A text input to the model.
1775
+ */
1776
+ export interface ResponseInputText {
1777
+ /**
1778
+ * The text input to the model.
1779
+ */
1780
+ text: string;
1781
+
1782
+ /**
1783
+ * The type of the input item. Always `input_text`.
1784
+ */
1785
+ type: 'input_text';
1786
+ }
1787
+
1788
+ /**
1789
+ * An audio output from the model.
1790
+ */
1791
+ export interface ResponseOutputAudio {
1792
+ /**
1793
+ * Base64-encoded audio data from the model.
1794
+ */
1795
+ data: string;
1796
+
1797
+ /**
1798
+ * The transcript of the audio data from the model.
1799
+ */
1800
+ transcript: string;
1801
+
1802
+ /**
1803
+ * The type of the output audio. Always `output_audio`.
1804
+ */
1805
+ type: 'output_audio';
1806
+ }
1807
+
1808
+ /**
1809
+ * An output message from the model.
1810
+ */
1811
+ export type ResponseOutputItem =
1812
+ | ResponseOutputMessage
1813
+ | ResponseFileSearchToolCall
1814
+ | ResponseFunctionToolCall
1815
+ | ResponseFunctionWebSearch
1816
+ | ResponseComputerToolCall
1817
+ | ResponseOutputItem.Reasoning;
1818
+
1819
+ export namespace ResponseOutputItem {
1820
+ /**
1821
+ * A description of the chain of thought used by a reasoning model while generating
1822
+ * a response.
1823
+ */
1824
+ export interface Reasoning {
1825
+ /**
1826
+ * The unique identifier of the reasoning content.
1827
+ */
1828
+ id: string;
1829
+
1830
+ /**
1831
+ * Reasoning text contents.
1832
+ */
1833
+ content: Array<Reasoning.Content>;
1834
+
1835
+ /**
1836
+ * The type of the object. Always `reasoning`.
1837
+ */
1838
+ type: 'reasoning';
1839
+
1840
+ /**
1841
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1842
+ * Populated when items are returned via API.
1843
+ */
1844
+ status?: 'in_progress' | 'completed' | 'incomplete';
1845
+ }
1846
+
1847
+ export namespace Reasoning {
1848
+ export interface Content {
1849
+ /**
1850
+ * A short summary of the reasoning used by the model when generating the response.
1851
+ */
1852
+ text: string;
1853
+
1854
+ /**
1855
+ * The type of the object. Always `text`.
1856
+ */
1857
+ type: 'reasoning_summary';
1858
+ }
1859
+ }
1860
+ }
1861
+
1862
+ /**
1863
+ * Emitted when a new output item is added.
1864
+ */
1865
+ export interface ResponseOutputItemAddedEvent {
1866
+ /**
1867
+ * The output item that was added.
1868
+ */
1869
+ item: ResponseOutputItem;
1870
+
1871
+ /**
1872
+ * The index of the output item that was added.
1873
+ */
1874
+ output_index: number;
1875
+
1876
+ /**
1877
+ * The type of the event. Always `response.output_item.added`.
1878
+ */
1879
+ type: 'response.output_item.added';
1880
+ }
1881
+
1882
+ /**
1883
+ * Emitted when an output item is marked done.
1884
+ */
1885
+ export interface ResponseOutputItemDoneEvent {
1886
+ /**
1887
+ * The output item that was marked done.
1888
+ */
1889
+ item: ResponseOutputItem;
1890
+
1891
+ /**
1892
+ * The index of the output item that was marked done.
1893
+ */
1894
+ output_index: number;
1895
+
1896
+ /**
1897
+ * The type of the event. Always `response.output_item.done`.
1898
+ */
1899
+ type: 'response.output_item.done';
1900
+ }
1901
+
1902
+ /**
1903
+ * An output message from the model.
1904
+ */
1905
+ export interface ResponseOutputMessage {
1906
+ /**
1907
+ * The unique ID of the output message.
1908
+ */
1909
+ id: string;
1910
+
1911
+ /**
1912
+ * The content of the output message.
1913
+ */
1914
+ content: Array<ResponseOutputText | ResponseOutputRefusal>;
1915
+
1916
+ /**
1917
+ * The role of the output message. Always `assistant`.
1918
+ */
1919
+ role: 'assistant';
1920
+
1921
+ /**
1922
+ * The status of the message input. One of `in_progress`, `completed`, or
1923
+ * `incomplete`. Populated when input items are returned via API.
1924
+ */
1925
+ status: 'in_progress' | 'completed' | 'incomplete';
1926
+
1927
+ /**
1928
+ * The type of the output message. Always `message`.
1929
+ */
1930
+ type: 'message';
1931
+ }
1932
+
1933
+ /**
1934
+ * A refusal from the model.
1935
+ */
1936
+ export interface ResponseOutputRefusal {
1937
+ /**
1938
+ * The refusal explanationfrom the model.
1939
+ */
1940
+ refusal: string;
1941
+
1942
+ /**
1943
+ * The type of the refusal. Always `refusal`.
1944
+ */
1945
+ type: 'refusal';
1946
+ }
1947
+
1948
+ /**
1949
+ * A text output from the model.
1950
+ */
1951
+ export interface ResponseOutputText {
1952
+ /**
1953
+ * The annotations of the text output.
1954
+ */
1955
+ annotations: Array<
1956
+ ResponseOutputText.FileCitation | ResponseOutputText.URLCitation | ResponseOutputText.FilePath
1957
+ >;
1958
+
1959
+ /**
1960
+ * The text output from the model.
1961
+ */
1962
+ text: string;
1963
+
1964
+ /**
1965
+ * The type of the output text. Always `output_text`.
1966
+ */
1967
+ type: 'output_text';
1968
+ }
1969
+
1970
+ export namespace ResponseOutputText {
1971
+ /**
1972
+ * A citation to a file.
1973
+ */
1974
+ export interface FileCitation {
1975
+ /**
1976
+ * The ID of the file.
1977
+ */
1978
+ file_id: string;
1979
+
1980
+ /**
1981
+ * The index of the file in the list of files.
1982
+ */
1983
+ index: number;
1984
+
1985
+ /**
1986
+ * The type of the file citation. Always `file_citation`.
1987
+ */
1988
+ type: 'file_citation';
1989
+ }
1990
+
1991
+ /**
1992
+ * A citation for a web resource used to generate a model response.
1993
+ */
1994
+ export interface URLCitation {
1995
+ /**
1996
+ * The index of the last character of the URL citation in the message.
1997
+ */
1998
+ end_index: number;
1999
+
2000
+ /**
2001
+ * The index of the first character of the URL citation in the message.
2002
+ */
2003
+ start_index: number;
2004
+
2005
+ /**
2006
+ * The title of the web resource.
2007
+ */
2008
+ title: string;
2009
+
2010
+ /**
2011
+ * The type of the URL citation. Always `url_citation`.
2012
+ */
2013
+ type: 'url_citation';
2014
+
2015
+ /**
2016
+ * The URL of the web resource.
2017
+ */
2018
+ url: string;
2019
+ }
2020
+
2021
+ /**
2022
+ * A path to a file.
2023
+ */
2024
+ export interface FilePath {
2025
+ /**
2026
+ * The ID of the file.
2027
+ */
2028
+ file_id: string;
2029
+
2030
+ /**
2031
+ * The index of the file in the list of files.
2032
+ */
2033
+ index: number;
2034
+
2035
+ /**
2036
+ * The type of the file path. Always `file_path`.
2037
+ */
2038
+ type: 'file_path';
2039
+ }
2040
+ }
2041
+
2042
+ /**
2043
+ * Emitted when there is a partial refusal text.
2044
+ */
2045
+ export interface ResponseRefusalDeltaEvent {
2046
+ /**
2047
+ * The index of the content part that the refusal text is added to.
2048
+ */
2049
+ content_index: number;
2050
+
2051
+ /**
2052
+ * The refusal text that is added.
2053
+ */
2054
+ delta: string;
2055
+
2056
+ /**
2057
+ * The ID of the output item that the refusal text is added to.
2058
+ */
2059
+ item_id: string;
2060
+
2061
+ /**
2062
+ * The index of the output item that the refusal text is added to.
2063
+ */
2064
+ output_index: number;
2065
+
2066
+ /**
2067
+ * The type of the event. Always `response.refusal.delta`.
2068
+ */
2069
+ type: 'response.refusal.delta';
2070
+ }
2071
+
2072
+ /**
2073
+ * Emitted when refusal text is finalized.
2074
+ */
2075
+ export interface ResponseRefusalDoneEvent {
2076
+ /**
2077
+ * The index of the content part that the refusal text is finalized.
2078
+ */
2079
+ content_index: number;
2080
+
2081
+ /**
2082
+ * The ID of the output item that the refusal text is finalized.
2083
+ */
2084
+ item_id: string;
2085
+
2086
+ /**
2087
+ * The index of the output item that the refusal text is finalized.
2088
+ */
2089
+ output_index: number;
2090
+
2091
+ /**
2092
+ * The refusal text that is finalized.
2093
+ */
2094
+ refusal: string;
2095
+
2096
+ /**
2097
+ * The type of the event. Always `response.refusal.done`.
2098
+ */
2099
+ type: 'response.refusal.done';
2100
+ }
2101
+
2102
+ /**
2103
+ * The status of the response generation. One of `completed`, `failed`,
2104
+ * `in_progress`, or `incomplete`.
2105
+ */
2106
+ export type ResponseStatus = 'completed' | 'failed' | 'in_progress' | 'incomplete';
2107
+
2108
+ /**
2109
+ * Emitted when there is a partial audio response.
2110
+ */
2111
+ export type ResponseStreamEvent =
2112
+ | ResponseAudioDeltaEvent
2113
+ | ResponseAudioDoneEvent
2114
+ | ResponseAudioTranscriptDeltaEvent
2115
+ | ResponseAudioTranscriptDoneEvent
2116
+ | ResponseCodeInterpreterCallCodeDeltaEvent
2117
+ | ResponseCodeInterpreterCallCodeDoneEvent
2118
+ | ResponseCodeInterpreterCallCompletedEvent
2119
+ | ResponseCodeInterpreterCallInProgressEvent
2120
+ | ResponseCodeInterpreterCallInterpretingEvent
2121
+ | ResponseCompletedEvent
2122
+ | ResponseContentPartAddedEvent
2123
+ | ResponseContentPartDoneEvent
2124
+ | ResponseCreatedEvent
2125
+ | ResponseErrorEvent
2126
+ | ResponseFileSearchCallCompletedEvent
2127
+ | ResponseFileSearchCallInProgressEvent
2128
+ | ResponseFileSearchCallSearchingEvent
2129
+ | ResponseFunctionCallArgumentsDeltaEvent
2130
+ | ResponseFunctionCallArgumentsDoneEvent
2131
+ | ResponseInProgressEvent
2132
+ | ResponseFailedEvent
2133
+ | ResponseIncompleteEvent
2134
+ | ResponseOutputItemAddedEvent
2135
+ | ResponseOutputItemDoneEvent
2136
+ | ResponseRefusalDeltaEvent
2137
+ | ResponseRefusalDoneEvent
2138
+ | ResponseTextAnnotationDeltaEvent
2139
+ | ResponseTextDeltaEvent
2140
+ | ResponseTextDoneEvent
2141
+ | ResponseWebSearchCallCompletedEvent
2142
+ | ResponseWebSearchCallInProgressEvent
2143
+ | ResponseWebSearchCallSearchingEvent;
2144
+
2145
+ /**
2146
+ * Emitted when a text annotation is added.
2147
+ */
2148
+ export interface ResponseTextAnnotationDeltaEvent {
2149
+ /**
2150
+ * A citation to a file.
2151
+ */
2152
+ annotation:
2153
+ | ResponseTextAnnotationDeltaEvent.FileCitation
2154
+ | ResponseTextAnnotationDeltaEvent.URLCitation
2155
+ | ResponseTextAnnotationDeltaEvent.FilePath;
2156
+
2157
+ /**
2158
+ * The index of the annotation that was added.
2159
+ */
2160
+ annotation_index: number;
2161
+
2162
+ /**
2163
+ * The index of the content part that the text annotation was added to.
2164
+ */
2165
+ content_index: number;
2166
+
2167
+ /**
2168
+ * The ID of the output item that the text annotation was added to.
2169
+ */
2170
+ item_id: string;
2171
+
2172
+ /**
2173
+ * The index of the output item that the text annotation was added to.
2174
+ */
2175
+ output_index: number;
2176
+
2177
+ /**
2178
+ * The type of the event. Always `response.output_text.annotation.added`.
2179
+ */
2180
+ type: 'response.output_text.annotation.added';
2181
+ }
2182
+
2183
+ export namespace ResponseTextAnnotationDeltaEvent {
2184
+ /**
2185
+ * A citation to a file.
2186
+ */
2187
+ export interface FileCitation {
2188
+ /**
2189
+ * The ID of the file.
2190
+ */
2191
+ file_id: string;
2192
+
2193
+ /**
2194
+ * The index of the file in the list of files.
2195
+ */
2196
+ index: number;
2197
+
2198
+ /**
2199
+ * The type of the file citation. Always `file_citation`.
2200
+ */
2201
+ type: 'file_citation';
2202
+ }
2203
+
2204
+ /**
2205
+ * A citation for a web resource used to generate a model response.
2206
+ */
2207
+ export interface URLCitation {
2208
+ /**
2209
+ * The index of the last character of the URL citation in the message.
2210
+ */
2211
+ end_index: number;
2212
+
2213
+ /**
2214
+ * The index of the first character of the URL citation in the message.
2215
+ */
2216
+ start_index: number;
2217
+
2218
+ /**
2219
+ * The title of the web resource.
2220
+ */
2221
+ title: string;
2222
+
2223
+ /**
2224
+ * The type of the URL citation. Always `url_citation`.
2225
+ */
2226
+ type: 'url_citation';
2227
+
2228
+ /**
2229
+ * The URL of the web resource.
2230
+ */
2231
+ url: string;
2232
+ }
2233
+
2234
+ /**
2235
+ * A path to a file.
2236
+ */
2237
+ export interface FilePath {
2238
+ /**
2239
+ * The ID of the file.
2240
+ */
2241
+ file_id: string;
2242
+
2243
+ /**
2244
+ * The index of the file in the list of files.
2245
+ */
2246
+ index: number;
2247
+
2248
+ /**
2249
+ * The type of the file path. Always `file_path`.
2250
+ */
2251
+ type: 'file_path';
2252
+ }
2253
+ }
2254
+
2255
+ /**
2256
+ * Configuration options for a text response from the model. Can be plain text or
2257
+ * structured JSON data. Learn more:
2258
+ *
2259
+ * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
2260
+ * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
2261
+ */
2262
+ export interface ResponseTextConfig {
2263
+ /**
2264
+ * An object specifying the format that the model must output.
2265
+ *
2266
+ * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
2267
+ * ensures the model will match your supplied JSON schema. Learn more in the
2268
+ * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
2269
+ *
2270
+ * The default format is `{ "type": "text" }` with no additional options.
2271
+ *
2272
+ * **Not recommended for gpt-4o and newer models:**
2273
+ *
2274
+ * Setting to `{ "type": "json_object" }` enables the older JSON mode, which
2275
+ * ensures the message the model generates is valid JSON. Using `json_schema` is
2276
+ * preferred for models that support it.
2277
+ */
2278
+ format?: ResponseFormatTextConfig;
2279
+ }
2280
+
2281
+ /**
2282
+ * Emitted when there is an additional text delta.
2283
+ */
2284
+ export interface ResponseTextDeltaEvent {
2285
+ /**
2286
+ * The index of the content part that the text delta was added to.
2287
+ */
2288
+ content_index: number;
2289
+
2290
+ /**
2291
+ * The text delta that was added.
2292
+ */
2293
+ delta: string;
2294
+
2295
+ /**
2296
+ * The ID of the output item that the text delta was added to.
2297
+ */
2298
+ item_id: string;
2299
+
2300
+ /**
2301
+ * The index of the output item that the text delta was added to.
2302
+ */
2303
+ output_index: number;
2304
+
2305
+ /**
2306
+ * The type of the event. Always `response.output_text.delta`.
2307
+ */
2308
+ type: 'response.output_text.delta';
2309
+ }
2310
+
2311
+ /**
2312
+ * Emitted when text content is finalized.
2313
+ */
2314
+ export interface ResponseTextDoneEvent {
2315
+ /**
2316
+ * The index of the content part that the text content is finalized.
2317
+ */
2318
+ content_index: number;
2319
+
2320
+ /**
2321
+ * The ID of the output item that the text content is finalized.
2322
+ */
2323
+ item_id: string;
2324
+
2325
+ /**
2326
+ * The index of the output item that the text content is finalized.
2327
+ */
2328
+ output_index: number;
2329
+
2330
+ /**
2331
+ * The text content that is finalized.
2332
+ */
2333
+ text: string;
2334
+
2335
+ /**
2336
+ * The type of the event. Always `response.output_text.done`.
2337
+ */
2338
+ type: 'response.output_text.done';
2339
+ }
2340
+
2341
+ /**
2342
+ * Represents token usage details including input tokens, output tokens, a
2343
+ * breakdown of output tokens, and the total tokens used.
2344
+ */
2345
+ export interface ResponseUsage {
2346
+ /**
2347
+ * The number of input tokens.
2348
+ */
2349
+ input_tokens: number;
2350
+
2351
+ /**
2352
+ * The number of output tokens.
2353
+ */
2354
+ output_tokens: number;
2355
+
2356
+ /**
2357
+ * A detailed breakdown of the output tokens.
2358
+ */
2359
+ output_tokens_details: ResponseUsage.OutputTokensDetails;
2360
+
2361
+ /**
2362
+ * The total number of tokens used.
2363
+ */
2364
+ total_tokens: number;
2365
+ }
2366
+
2367
+ export namespace ResponseUsage {
2368
+ /**
2369
+ * A detailed breakdown of the output tokens.
2370
+ */
2371
+ export interface OutputTokensDetails {
2372
+ /**
2373
+ * The number of reasoning tokens.
2374
+ */
2375
+ reasoning_tokens: number;
2376
+ }
2377
+ }
2378
+
2379
+ /**
2380
+ * Emitted when a web search call is completed.
2381
+ */
2382
+ export interface ResponseWebSearchCallCompletedEvent {
2383
+ /**
2384
+ * Unique ID for the output item associated with the web search call.
2385
+ */
2386
+ item_id: string;
2387
+
2388
+ /**
2389
+ * The index of the output item that the web search call is associated with.
2390
+ */
2391
+ output_index: number;
2392
+
2393
+ /**
2394
+ * The type of the event. Always `response.web_search_call.completed`.
2395
+ */
2396
+ type: 'response.web_search_call.completed';
2397
+ }
2398
+
2399
+ /**
2400
+ * Emitted when a web search call is initiated.
2401
+ */
2402
+ export interface ResponseWebSearchCallInProgressEvent {
2403
+ /**
2404
+ * Unique ID for the output item associated with the web search call.
2405
+ */
2406
+ item_id: string;
2407
+
2408
+ /**
2409
+ * The index of the output item that the web search call is associated with.
2410
+ */
2411
+ output_index: number;
2412
+
2413
+ /**
2414
+ * The type of the event. Always `response.web_search_call.in_progress`.
2415
+ */
2416
+ type: 'response.web_search_call.in_progress';
2417
+ }
2418
+
2419
+ /**
2420
+ * Emitted when a web search call is executing.
2421
+ */
2422
+ export interface ResponseWebSearchCallSearchingEvent {
2423
+ /**
2424
+ * Unique ID for the output item associated with the web search call.
2425
+ */
2426
+ item_id: string;
2427
+
2428
+ /**
2429
+ * The index of the output item that the web search call is associated with.
2430
+ */
2431
+ output_index: number;
2432
+
2433
+ /**
2434
+ * The type of the event. Always `response.web_search_call.searching`.
2435
+ */
2436
+ type: 'response.web_search_call.searching';
2437
+ }
2438
+
2439
+ /**
2440
+ * A tool that searches for relevant content from uploaded files. Learn more about
2441
+ * the
2442
+ * [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
2443
+ */
2444
+ export type Tool = FileSearchTool | FunctionTool | ComputerTool | WebSearchTool;
2445
+
2446
+ /**
2447
+ * Use this option to force the model to call a specific function.
2448
+ */
2449
+ export interface ToolChoiceFunction {
2450
+ /**
2451
+ * The name of the function to call.
2452
+ */
2453
+ name: string;
2454
+
2455
+ /**
2456
+ * For function calling, the type is always `function`.
2457
+ */
2458
+ type: 'function';
2459
+ }
2460
+
2461
+ /**
2462
+ * Controls which (if any) tool is called by the model.
2463
+ *
2464
+ * `none` means the model will not call any tool and instead generates a message.
2465
+ *
2466
+ * `auto` means the model can pick between generating a message or calling one or
2467
+ * more tools.
2468
+ *
2469
+ * `required` means the model must call one or more tools.
2470
+ */
2471
+ export type ToolChoiceOptions = 'none' | 'auto' | 'required';
2472
+
2473
+ /**
2474
+ * Indicates that the model should use a built-in tool to generate a response.
2475
+ * [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
2476
+ */
2477
+ export interface ToolChoiceTypes {
2478
+ /**
2479
+ * The type of hosted tool the model should to use. Learn more about
2480
+ * [built-in tools](https://platform.openai.com/docs/guides/tools).
2481
+ *
2482
+ * Allowed values are:
2483
+ *
2484
+ * - `file_search`
2485
+ * - `web_search_preview`
2486
+ * - `computer_use_preview`
2487
+ */
2488
+ type: 'file_search' | 'web_search_preview' | 'computer_use_preview' | 'web_search_preview_2025_03_11';
2489
+ }
2490
+
2491
+ /**
2492
+ * This tool searches the web for relevant results to use in a response. Learn more
2493
+ * about the
2494
+ * [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
2495
+ */
2496
+ export interface WebSearchTool {
2497
+ /**
2498
+ * The type of the web search tool. One of:
2499
+ *
2500
+ * - `web_search_preview`
2501
+ * - `web_search_preview_2025_03_11`
2502
+ */
2503
+ type: 'web_search_preview' | 'web_search_preview_2025_03_11';
2504
+
2505
+ /**
2506
+ * High level guidance for the amount of context window space to use for the
2507
+ * search. One of `low`, `medium`, or `high`. `medium` is the default.
2508
+ */
2509
+ search_context_size?: 'low' | 'medium' | 'high';
2510
+
2511
+ user_location?: WebSearchTool.UserLocation | null;
2512
+ }
2513
+
2514
+ export namespace WebSearchTool {
2515
+ export interface UserLocation {
2516
+ /**
2517
+ * The type of location approximation. Always `approximate`.
2518
+ */
2519
+ type: 'approximate';
2520
+
2521
+ /**
2522
+ * Free text input for the city of the user, e.g. `San Francisco`.
2523
+ */
2524
+ city?: string;
2525
+
2526
+ /**
2527
+ * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
2528
+ * the user, e.g. `US`.
2529
+ */
2530
+ country?: string;
2531
+
2532
+ /**
2533
+ * Free text input for the region of the user, e.g. `California`.
2534
+ */
2535
+ region?: string;
2536
+
2537
+ /**
2538
+ * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
2539
+ * user, e.g. `America/Los_Angeles`.
2540
+ */
2541
+ timezone?: string;
2542
+ }
2543
+ }
2544
+
2545
+ export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming;
2546
+
2547
+ export interface ResponseCreateParamsBase {
2548
+ /**
2549
+ * Text, image, or file inputs to the model, used to generate a response.
2550
+ *
2551
+ * Learn more:
2552
+ *
2553
+ * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
2554
+ * - [Image inputs](https://platform.openai.com/docs/guides/images)
2555
+ * - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
2556
+ * - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
2557
+ * - [Function calling](https://platform.openai.com/docs/guides/function-calling)
2558
+ */
2559
+ input: string | ResponseInput;
2560
+
2561
+ /**
2562
+ * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a
2563
+ * wide range of models with different capabilities, performance characteristics,
2564
+ * and price points. Refer to the
2565
+ * [model guide](https://platform.openai.com/docs/models) to browse and compare
2566
+ * available models.
2567
+ */
2568
+ model: (string & {}) | Shared.ChatModel;
2569
+
2570
+ /**
2571
+ * Specify additional output data to include in the model response. Currently
2572
+ * supported values are:
2573
+ *
2574
+ * - `file_search_call.results`: Include the search results of the file search tool
2575
+ * call.
2576
+ * - `message.input_image.image_url`: Include image urls from the input message.
2577
+ * - `computer_call_output.output.image_url`: Include image urls from the computer
2578
+ * call output.
2579
+ */
2580
+ include?: Array<ResponseIncludable> | null;
2581
+
2582
+ /**
2583
+ * Inserts a system (or developer) message as the first item in the model's
2584
+ * context.
2585
+ *
2586
+ * When using along with `previous_response_id`, the instructions from a previous
2587
+ * response will be not be carried over to the next response. This makes it simple
2588
+ * to swap out system (or developer) messages in new responses.
2589
+ */
2590
+ instructions?: string | null;
2591
+
2592
+ /**
2593
+ * An upper bound for the number of tokens that can be generated for a response,
2594
+ * including visible output tokens and
2595
+ * [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
2596
+ */
2597
+ max_output_tokens?: number | null;
2598
+
2599
+ /**
2600
+ * Set of 16 key-value pairs that can be attached to an object. This can be useful
2601
+ * for storing additional information about the object in a structured format, and
2602
+ * querying for objects via API or the dashboard.
2603
+ *
2604
+ * Keys are strings with a maximum length of 64 characters. Values are strings with
2605
+ * a maximum length of 512 characters.
2606
+ */
2607
+ metadata?: Shared.Metadata | null;
2608
+
2609
+ /**
2610
+ * Whether to allow the model to run tool calls in parallel.
2611
+ */
2612
+ parallel_tool_calls?: boolean | null;
2613
+
2614
+ /**
2615
+ * The unique ID of the previous response to the model. Use this to create
2616
+ * multi-turn conversations. Learn more about
2617
+ * [conversation state](https://platform.openai.com/docs/guides/conversation-state).
2618
+ */
2619
+ previous_response_id?: string | null;
2620
+
2621
+ /**
2622
+ * **o-series models only**
2623
+ *
2624
+ * Configuration options for
2625
+ * [reasoning models](https://platform.openai.com/docs/guides/reasoning).
2626
+ */
2627
+ reasoning?: Shared.Reasoning | null;
2628
+
2629
+ /**
2630
+ * Whether to store the generated model response for later retrieval via API.
2631
+ */
2632
+ store?: boolean | null;
2633
+
2634
+ /**
2635
+ * If set to true, the model response data will be streamed to the client as it is
2636
+ * generated using
2637
+ * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
2638
+ * See the
2639
+ * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
2640
+ * for more information.
2641
+ */
2642
+ stream?: boolean | null;
2643
+
2644
+ /**
2645
+ * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
2646
+ * make the output more random, while lower values like 0.2 will make it more
2647
+ * focused and deterministic. We generally recommend altering this or `top_p` but
2648
+ * not both.
2649
+ */
2650
+ temperature?: number | null;
2651
+
2652
+ /**
2653
+ * Configuration options for a text response from the model. Can be plain text or
2654
+ * structured JSON data. Learn more:
2655
+ *
2656
+ * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
2657
+ * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
2658
+ */
2659
+ text?: ResponseTextConfig;
2660
+
2661
+ /**
2662
+ * How the model should select which tool (or tools) to use when generating a
2663
+ * response. See the `tools` parameter to see how to specify which tools the model
2664
+ * can call.
2665
+ */
2666
+ tool_choice?: ToolChoiceOptions | ToolChoiceTypes | ToolChoiceFunction;
2667
+
2668
+ /**
2669
+ * An array of tools the model may call while generating a response. You can
2670
+ * specify which tool to use by setting the `tool_choice` parameter.
2671
+ *
2672
+ * The two categories of tools you can provide the model are:
2673
+ *
2674
+ * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
2675
+ * capabilities, like
2676
+ * [web search](https://platform.openai.com/docs/guides/tools-web-search) or
2677
+ * [file search](https://platform.openai.com/docs/guides/tools-file-search).
2678
+ * Learn more about
2679
+ * [built-in tools](https://platform.openai.com/docs/guides/tools).
2680
+ * - **Function calls (custom tools)**: Functions that are defined by you, enabling
2681
+ * the model to call your own code. Learn more about
2682
+ * [function calling](https://platform.openai.com/docs/guides/function-calling).
2683
+ */
2684
+ tools?: Array<Tool>;
2685
+
2686
+ /**
2687
+ * An alternative to sampling with temperature, called nucleus sampling, where the
2688
+ * model considers the results of the tokens with top_p probability mass. So 0.1
2689
+ * means only the tokens comprising the top 10% probability mass are considered.
2690
+ *
2691
+ * We generally recommend altering this or `temperature` but not both.
2692
+ */
2693
+ top_p?: number | null;
2694
+
2695
+ /**
2696
+ * The truncation strategy to use for the model response.
2697
+ *
2698
+ * - `auto`: If the context of this response and previous ones exceeds the model's
2699
+ * context window size, the model will truncate the response to fit the context
2700
+ * window by dropping input items in the middle of the conversation.
2701
+ * - `disabled` (default): If a model response will exceed the context window size
2702
+ * for a model, the request will fail with a 400 error.
2703
+ */
2704
+ truncation?: 'auto' | 'disabled' | null;
2705
+
2706
+ /**
2707
+ * A unique identifier representing your end-user, which can help OpenAI to monitor
2708
+ * and detect abuse.
2709
+ * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
2710
+ */
2711
+ user?: string;
2712
+ }
2713
+
2714
+ export namespace ResponseCreateParams {
2715
+ export type ResponseCreateParamsNonStreaming = ResponsesAPI.ResponseCreateParamsNonStreaming;
2716
+ export type ResponseCreateParamsStreaming = ResponsesAPI.ResponseCreateParamsStreaming;
2717
+ }
2718
+
2719
+ export interface ResponseCreateParamsNonStreaming extends ResponseCreateParamsBase {
2720
+ /**
2721
+ * If set to true, the model response data will be streamed to the client as it is
2722
+ * generated using
2723
+ * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
2724
+ * See the
2725
+ * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
2726
+ * for more information.
2727
+ */
2728
+ stream?: false | null;
2729
+ }
2730
+
2731
+ export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase {
2732
+ /**
2733
+ * If set to true, the model response data will be streamed to the client as it is
2734
+ * generated using
2735
+ * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
2736
+ * See the
2737
+ * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
2738
+ * for more information.
2739
+ */
2740
+ stream: true;
2741
+ }
2742
+
2743
+ export interface ResponseRetrieveParams {
2744
+ /**
2745
+ * Additional fields to include in the response. See the `include` parameter for
2746
+ * Response creation above for more information.
2747
+ */
2748
+ include?: Array<ResponseIncludable>;
2749
+ }
2750
+
2751
+ Responses.InputItems = InputItems;
2752
+ Responses.ResponseItemListDataPage = ResponseItemListDataPage;
2753
+
2754
+ export declare namespace Responses {
2755
+ export {
2756
+ InputItems as InputItems,
2757
+ type ResponseItemList as ResponseItemList,
2758
+ ResponseItemListDataPage as ResponseItemListDataPage,
2759
+ type InputItemListParams as InputItemListParams,
2760
+ };
2761
+ }