openai 4.87.2 → 4.87.4

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 (45) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/index.d.mts +2 -2
  3. package/index.d.ts +2 -2
  4. package/index.d.ts.map +1 -1
  5. package/index.js.map +1 -1
  6. package/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/resources/batches.d.ts +4 -4
  9. package/resources/batches.d.ts.map +1 -1
  10. package/resources/chat/completions/completions.d.ts +12 -6
  11. package/resources/chat/completions/completions.d.ts.map +1 -1
  12. package/resources/chat/completions/completions.js.map +1 -1
  13. package/resources/chat/completions/completions.mjs.map +1 -1
  14. package/resources/responses/index.d.ts +1 -1
  15. package/resources/responses/index.d.ts.map +1 -1
  16. package/resources/responses/index.js +1 -2
  17. package/resources/responses/index.js.map +1 -1
  18. package/resources/responses/index.mjs +1 -1
  19. package/resources/responses/index.mjs.map +1 -1
  20. package/resources/responses/input-items.d.ts +7 -121
  21. package/resources/responses/input-items.d.ts.map +1 -1
  22. package/resources/responses/input-items.js +4 -7
  23. package/resources/responses/input-items.js.map +1 -1
  24. package/resources/responses/input-items.mjs +3 -5
  25. package/resources/responses/input-items.mjs.map +1 -1
  26. package/resources/responses/responses.d.ts +190 -101
  27. package/resources/responses/responses.d.ts.map +1 -1
  28. package/resources/responses/responses.js +5 -2
  29. package/resources/responses/responses.js.map +1 -1
  30. package/resources/responses/responses.mjs +4 -2
  31. package/resources/responses/responses.mjs.map +1 -1
  32. package/resources/shared.d.ts +2 -2
  33. package/resources/shared.d.ts.map +1 -1
  34. package/src/index.ts +4 -0
  35. package/src/resources/batches.ts +4 -4
  36. package/src/resources/chat/completions/completions.ts +12 -6
  37. package/src/resources/responses/index.ts +1 -6
  38. package/src/resources/responses/input-items.ts +10 -199
  39. package/src/resources/responses/input-items.ts.orig +114 -0
  40. package/src/resources/responses/responses.ts +230 -118
  41. package/src/resources/shared.ts +2 -2
  42. package/src/version.ts +1 -1
  43. package/version.d.ts +1 -1
  44. package/version.js +1 -1
  45. package/version.mjs +1 -1
@@ -3,8 +3,9 @@ import { parseResponse, addOutputText, } from "../../lib/ResponsesParser.mjs";
3
3
  import { isRequestOptions } from "../../core.mjs";
4
4
  import { APIResource } from "../../resource.mjs";
5
5
  import * as InputItemsAPI from "./input-items.mjs";
6
- import { InputItems, ResponseItemListDataPage } from "./input-items.mjs";
6
+ import { InputItems } from "./input-items.mjs";
7
7
  import { ResponseStream } from "../../lib/responses/ResponseStream.mjs";
8
+ import { CursorPage } from "../../pagination.mjs";
8
9
  export class Responses extends APIResource {
9
10
  constructor() {
10
11
  super(...arguments);
@@ -45,6 +46,7 @@ export class Responses extends APIResource {
45
46
  return ResponseStream.createResponse(this._client, body, options);
46
47
  }
47
48
  }
49
+ export class ResponseItemsPage extends CursorPage {
50
+ }
48
51
  Responses.InputItems = InputItems;
49
- Responses.ResponseItemListDataPage = ResponseItemListDataPage;
50
52
  //# sourceMappingURL=responses.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"responses.mjs","sourceRoot":"","sources":["../../src/resources/responses/responses.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAEL,aAAa,EAEb,aAAa,GACd;OAEM,EAAc,gBAAgB,EAAE;OAChC,EAAE,WAAW,EAAE;OAGf,KAAK,aAAa;OAClB,EAAuB,UAAU,EAAoB,wBAAwB,EAAE;OAE/E,EAAE,cAAc,EAAwB;AA+B/C,MAAM,OAAO,SAAU,SAAQ,WAAW;IAA1C;;QACE,eAAU,GAA6B,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAyFpF,CAAC;IAjEC,MAAM,CACJ,IAA0B,EAC1B,OAA6B;QAE7B,OACE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,K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AAkB,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,UAAU,EAAE,EAAE;YACrD,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CACH,IAAY,EACZ,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS;aAC1B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;aACrB,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,QAAoB,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,MAAM,CACJ,IAAY,EACZ,OAA6B;QAE7B,OAAO,cAAc,CAAC,cAAc,CAAU,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,UAAwB;CAAG;AAoqFlE,SAAS,CAAC,UAAU,GAAG,UAAU,CAAC"}
@@ -109,9 +109,9 @@ export interface Reasoning {
109
109
  * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
110
110
  * result in faster responses and fewer tokens used on reasoning in a response.
111
111
  */
112
- effort: ReasoningEffort | null;
112
+ effort?: ReasoningEffort | null;
113
113
  /**
114
- * **o-series models only**
114
+ * **computer_use_preview only**
115
115
  *
116
116
  * A summary of the reasoning performed by the model. This can be useful for
117
117
  * debugging and understanding the model's reasoning process. One of `concise` or
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,oBAAoB,GACpB,IAAI,GACJ,eAAe,GACf,YAAY,GACZ,uBAAuB,GACvB,SAAS,GACT,oBAAoB,GACpB,sBAAsB,GACtB,iCAAiC,GACjC,iC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AC,CAAC;QAEjC;;;;;;WAMG;QACH,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;KACzB;CACF;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
package/src/index.ts CHANGED
@@ -118,6 +118,7 @@ import {
118
118
  ChatCompletionModality,
119
119
  ChatCompletionNamedToolChoice,
120
120
  ChatCompletionPredictionContent,
121
+ ChatCompletionReasoningEffort,
121
122
  ChatCompletionRole,
122
123
  ChatCompletionStoreMessage,
123
124
  ChatCompletionStreamOptions,
@@ -129,6 +130,7 @@ import {
129
130
  ChatCompletionUpdateParams,
130
131
  ChatCompletionUserMessageParam,
131
132
  ChatCompletionsPage,
133
+ CreateChatCompletionRequestMessage,
132
134
  } from './resources/chat/completions/completions';
133
135
 
134
136
  export interface ClientOptions {
@@ -404,6 +406,8 @@ export declare namespace OpenAI {
404
406
  type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption,
405
407
  type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam,
406
408
  type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam,
409
+ type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage,
410
+ type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort,
407
411
  ChatCompletionsPage as ChatCompletionsPage,
408
412
  type ChatCompletionCreateParams as ChatCompletionCreateParams,
409
413
  type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming,
@@ -220,11 +220,11 @@ export interface BatchCreateParams {
220
220
 
221
221
  /**
222
222
  * The endpoint to be used for all requests in the batch. Currently
223
- * `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported.
224
- * Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000
225
- * embedding inputs across all requests in the batch.
223
+ * `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions`
224
+ * are supported. Note that `/v1/embeddings` batches are also restricted to a
225
+ * maximum of 50,000 embedding inputs across all requests in the batch.
226
226
  */
227
- endpoint: '/v1/chat/completions' | '/v1/embeddings' | '/v1/completions';
227
+ endpoint: '/v1/responses' | '/v1/chat/completions' | '/v1/embeddings' | '/v1/completions';
228
228
 
229
229
  /**
230
230
  * The ID of an uploaded file that contains requests for the new batch.
@@ -377,10 +377,13 @@ export interface ChatCompletionChunk {
377
377
  /**
378
378
  * An optional field that will only be present when you set
379
379
  * `stream_options: {"include_usage": true}` in your request. When present, it
380
- * contains a null value except for the last chunk which contains the token usage
381
- * statistics for the entire request.
380
+ * contains a null value **except for the last chunk** which contains the token
381
+ * usage statistics for the entire request.
382
+ *
383
+ * **NOTE:** If the stream is interrupted or cancelled, you may not receive the
384
+ * final usage chunk which contains the total token usage for the request.
382
385
  */
383
- usage?: CompletionsAPI.CompletionUsage | null;
386
+ usage?: CompletionsAPI.CompletionUsage;
384
387
  }
385
388
 
386
389
  export namespace ChatCompletionChunk {
@@ -551,7 +554,7 @@ export namespace ChatCompletionContentPart {
551
554
  /**
552
555
  * The name of the file, used when passing the file to the model as a string.
553
556
  */
554
- file_name?: string;
557
+ filename?: string;
555
558
  }
556
559
  }
557
560
  }
@@ -930,8 +933,11 @@ export interface ChatCompletionStreamOptions {
930
933
  /**
931
934
  * If set, an additional chunk will be streamed before the `data: [DONE]` message.
932
935
  * The `usage` field on this chunk shows the token usage statistics for the entire
933
- * request, and the `choices` field will always be an empty array. All other chunks
934
- * will also include a `usage` field, but with a null value.
936
+ * request, and the `choices` field will always be an empty array.
937
+ *
938
+ * All other chunks will also include a `usage` field, but with a null value.
939
+ * **NOTE:** If the stream is interrupted, you may not receive the final usage
940
+ * chunk which contains the total token usage for the request.
935
941
  */
936
942
  include_usage?: boolean;
937
943
  }
@@ -1,9 +1,4 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export {
4
- ResponseItemListDataPage,
5
- InputItems,
6
- type ResponseItemList,
7
- type InputItemListParams,
8
- } from './input-items';
3
+ export { InputItems, type ResponseItemList, type InputItemListParams } from './input-items';
9
4
  export { Responses } from './responses';
@@ -4,7 +4,8 @@ import { APIResource } from '../../resource';
4
4
  import { isRequestOptions } from '../../core';
5
5
  import * as Core from '../../core';
6
6
  import * as ResponsesAPI from './responses';
7
- import { CursorPage, type CursorPageParams } from '../../pagination';
7
+ import { ResponseItemsPage } from './responses';
8
+ import { type CursorPageParams } from '../../pagination';
8
9
 
9
10
  export class InputItems extends APIResource {
10
11
  /**
@@ -14,67 +15,26 @@ export class InputItems extends APIResource {
14
15
  responseId: string,
15
16
  query?: InputItemListParams,
16
17
  options?: Core.RequestOptions,
17
- ): Core.PagePromise<
18
- ResponseItemListDataPage,
19
- | ResponseItemList.Message
20
- | ResponsesAPI.ResponseOutputMessage
21
- | ResponsesAPI.ResponseFileSearchToolCall
22
- | ResponsesAPI.ResponseComputerToolCall
23
- | ResponseItemList.ComputerCallOutput
24
- | ResponsesAPI.ResponseFunctionWebSearch
25
- | ResponsesAPI.ResponseFunctionToolCall
26
- | ResponseItemList.FunctionCallOutput
27
- >;
18
+ ): Core.PagePromise<ResponseItemsPage, ResponsesAPI.ResponseItem>;
28
19
  list(
29
20
  responseId: string,
30
21
  options?: Core.RequestOptions,
31
- ): Core.PagePromise<
32
- ResponseItemListDataPage,
33
- | ResponseItemList.Message
34
- | ResponsesAPI.ResponseOutputMessage
35
- | ResponsesAPI.ResponseFileSearchToolCall
36
- | ResponsesAPI.ResponseComputerToolCall
37
- | ResponseItemList.ComputerCallOutput
38
- | ResponsesAPI.ResponseFunctionWebSearch
39
- | ResponsesAPI.ResponseFunctionToolCall
40
- | ResponseItemList.FunctionCallOutput
41
- >;
22
+ ): Core.PagePromise<ResponseItemsPage, ResponsesAPI.ResponseItem>;
42
23
  list(
43
24
  responseId: string,
44
25
  query: InputItemListParams | Core.RequestOptions = {},
45
26
  options?: Core.RequestOptions,
46
- ): Core.PagePromise<
47
- ResponseItemListDataPage,
48
- | ResponseItemList.Message
49
- | ResponsesAPI.ResponseOutputMessage
50
- | ResponsesAPI.ResponseFileSearchToolCall
51
- | ResponsesAPI.ResponseComputerToolCall
52
- | ResponseItemList.ComputerCallOutput
53
- | ResponsesAPI.ResponseFunctionWebSearch
54
- | ResponsesAPI.ResponseFunctionToolCall
55
- | ResponseItemList.FunctionCallOutput
56
- > {
27
+ ): Core.PagePromise<ResponseItemsPage, ResponsesAPI.ResponseItem> {
57
28
  if (isRequestOptions(query)) {
58
29
  return this.list(responseId, {}, query);
59
30
  }
60
- return this._client.getAPIList(`/responses/${responseId}/input_items`, ResponseItemListDataPage, {
31
+ return this._client.getAPIList(`/responses/${responseId}/input_items`, ResponseItemsPage, {
61
32
  query,
62
33
  ...options,
63
34
  });
64
35
  }
65
36
  }
66
37
 
67
- export class ResponseItemListDataPage extends CursorPage<
68
- | ResponseItemList.Message
69
- | ResponsesAPI.ResponseOutputMessage
70
- | ResponsesAPI.ResponseFileSearchToolCall
71
- | ResponsesAPI.ResponseComputerToolCall
72
- | ResponseItemList.ComputerCallOutput
73
- | ResponsesAPI.ResponseFunctionWebSearch
74
- | ResponsesAPI.ResponseFunctionToolCall
75
- | ResponseItemList.FunctionCallOutput
76
- > {}
77
-
78
38
  /**
79
39
  * A list of Response items.
80
40
  */
@@ -82,16 +42,7 @@ export interface ResponseItemList {
82
42
  /**
83
43
  * A list of items used to generate this response.
84
44
  */
85
- data: Array<
86
- | ResponseItemList.Message
87
- | ResponsesAPI.ResponseOutputMessage
88
- | ResponsesAPI.ResponseFileSearchToolCall
89
- | ResponsesAPI.ResponseComputerToolCall
90
- | ResponseItemList.ComputerCallOutput
91
- | ResponsesAPI.ResponseFunctionWebSearch
92
- | ResponsesAPI.ResponseFunctionToolCall
93
- | ResponseItemList.FunctionCallOutput
94
- >;
45
+ data: Array<ResponsesAPI.ResponseItem>;
95
46
 
96
47
  /**
97
48
  * The ID of the first item in the list.
@@ -114,142 +65,6 @@ export interface ResponseItemList {
114
65
  object: 'list';
115
66
  }
116
67
 
117
- export namespace ResponseItemList {
118
- export interface Message {
119
- /**
120
- * The unique ID of the message input.
121
- */
122
- id: string;
123
-
124
- /**
125
- * A list of one or many input items to the model, containing different content
126
- * types.
127
- */
128
- content: ResponsesAPI.ResponseInputMessageContentList;
129
-
130
- /**
131
- * The role of the message input. One of `user`, `system`, or `developer`.
132
- */
133
- role: 'user' | 'system' | 'developer';
134
-
135
- /**
136
- * The status of item. One of `in_progress`, `completed`, or `incomplete`.
137
- * Populated when items are returned via API.
138
- */
139
- status?: 'in_progress' | 'completed' | 'incomplete';
140
-
141
- /**
142
- * The type of the message input. Always set to `message`.
143
- */
144
- type?: 'message';
145
- }
146
-
147
- export interface ComputerCallOutput {
148
- /**
149
- * The unique ID of the computer call tool output.
150
- */
151
- id: string;
152
-
153
- /**
154
- * The ID of the computer tool call that produced the output.
155
- */
156
- call_id: string;
157
-
158
- /**
159
- * A computer screenshot image used with the computer use tool.
160
- */
161
- output: ComputerCallOutput.Output;
162
-
163
- /**
164
- * The type of the computer tool call output. Always `computer_call_output`.
165
- */
166
- type: 'computer_call_output';
167
-
168
- /**
169
- * The safety checks reported by the API that have been acknowledged by the
170
- * developer.
171
- */
172
- acknowledged_safety_checks?: Array<ComputerCallOutput.AcknowledgedSafetyCheck>;
173
-
174
- /**
175
- * The status of the message input. One of `in_progress`, `completed`, or
176
- * `incomplete`. Populated when input items are returned via API.
177
- */
178
- status?: 'in_progress' | 'completed' | 'incomplete';
179
- }
180
-
181
- export namespace ComputerCallOutput {
182
- /**
183
- * A computer screenshot image used with the computer use tool.
184
- */
185
- export interface Output {
186
- /**
187
- * Specifies the event type. For a computer screenshot, this property is always set
188
- * to `computer_screenshot`.
189
- */
190
- type: 'computer_screenshot';
191
-
192
- /**
193
- * The identifier of an uploaded file that contains the screenshot.
194
- */
195
- file_id?: string;
196
-
197
- /**
198
- * The URL of the screenshot image.
199
- */
200
- image_url?: string;
201
- }
202
-
203
- /**
204
- * A pending safety check for the computer call.
205
- */
206
- export interface AcknowledgedSafetyCheck {
207
- /**
208
- * The ID of the pending safety check.
209
- */
210
- id: string;
211
-
212
- /**
213
- * The type of the pending safety check.
214
- */
215
- code: string;
216
-
217
- /**
218
- * Details about the pending safety check.
219
- */
220
- message: string;
221
- }
222
- }
223
-
224
- export interface FunctionCallOutput {
225
- /**
226
- * The unique ID of the function call tool output.
227
- */
228
- id: string;
229
-
230
- /**
231
- * The unique ID of the function tool call generated by the model.
232
- */
233
- call_id: string;
234
-
235
- /**
236
- * A JSON string of the output of the function tool call.
237
- */
238
- output: string;
239
-
240
- /**
241
- * The type of the function tool call output. Always `function_call_output`.
242
- */
243
- type: 'function_call_output';
244
-
245
- /**
246
- * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
247
- * Populated when items are returned via API.
248
- */
249
- status?: 'in_progress' | 'completed' | 'incomplete';
250
- }
251
- }
252
-
253
68
  export interface InputItemListParams extends CursorPageParams {
254
69
  /**
255
70
  * An item ID to list items before, used in pagination.
@@ -265,12 +80,8 @@ export interface InputItemListParams extends CursorPageParams {
265
80
  order?: 'asc' | 'desc';
266
81
  }
267
82
 
268
- InputItems.ResponseItemListDataPage = ResponseItemListDataPage;
269
-
270
83
  export declare namespace InputItems {
271
- export {
272
- type ResponseItemList as ResponseItemList,
273
- ResponseItemListDataPage as ResponseItemListDataPage,
274
- type InputItemListParams as InputItemListParams,
275
- };
84
+ export { type ResponseItemList as ResponseItemList, type InputItemListParams as InputItemListParams };
276
85
  }
86
+
87
+ export { ResponseItemsPage };
@@ -0,0 +1,114 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import { isRequestOptions } from '../../core';
5
+ import * as Core from '../../core';
6
+ import * as ResponsesAPI from './responses';
7
+ import { ResponseItemsPage } from './responses';
8
+ import { type CursorPageParams } from '../../pagination';
9
+
10
+ export class InputItems extends APIResource {
11
+ /**
12
+ * Returns a list of input items for a given response.
13
+ */
14
+ list(
15
+ responseId: string,
16
+ query?: InputItemListParams,
17
+ options?: Core.RequestOptions,
18
+ ): Core.PagePromise<ResponseItemsPage, ResponsesAPI.ResponseItem>;
19
+ list(
20
+ responseId: string,
21
+ options?: Core.RequestOptions,
22
+ ): Core.PagePromise<ResponseItemsPage, ResponsesAPI.ResponseItem>;
23
+ list(
24
+ responseId: string,
25
+ query: InputItemListParams | Core.RequestOptions = {},
26
+ options?: Core.RequestOptions,
27
+ ): Core.PagePromise<ResponseItemsPage, ResponsesAPI.ResponseItem> {
28
+ if (isRequestOptions(query)) {
29
+ return this.list(responseId, {}, query);
30
+ }
31
+ return this._client.getAPIList(`/responses/${responseId}/input_items`, ResponseItemsPage, {
32
+ query,
33
+ ...options,
34
+ });
35
+ }
36
+ }
37
+
38
+ <<<<<<< HEAD
39
+ export class ResponseItemListDataPage extends CursorPage<
40
+ // @ts-ignore some items don't necessarily have the `id` property
41
+ | ResponseItemList.Message
42
+ | ResponsesAPI.ResponseOutputMessage
43
+ | ResponsesAPI.ResponseFileSearchToolCall
44
+ | ResponsesAPI.ResponseComputerToolCall
45
+ | ResponseItemList.ComputerCallOutput
46
+ | ResponsesAPI.ResponseFunctionWebSearch
47
+ | ResponsesAPI.ResponseFunctionToolCall
48
+ | ResponseItemList.FunctionCallOutput
49
+ > {}
50
+
51
+ ||||||| parent of e5ea4a71 (fix(types): improve responses type names (#1392))
52
+ export class ResponseItemListDataPage extends CursorPage<
53
+ | ResponseItemList.Message
54
+ | ResponsesAPI.ResponseOutputMessage
55
+ | ResponsesAPI.ResponseFileSearchToolCall
56
+ | ResponsesAPI.ResponseComputerToolCall
57
+ | ResponseItemList.ComputerCallOutput
58
+ | ResponsesAPI.ResponseFunctionWebSearch
59
+ | ResponsesAPI.ResponseFunctionToolCall
60
+ | ResponseItemList.FunctionCallOutput
61
+ > {}
62
+
63
+ =======
64
+ >>>>>>> e5ea4a71 (fix(types): improve responses type names (#1392))
65
+ /**
66
+ * A list of Response items.
67
+ */
68
+ export interface ResponseItemList {
69
+ /**
70
+ * A list of items used to generate this response.
71
+ */
72
+ data: Array<ResponsesAPI.ResponseItem>;
73
+
74
+ /**
75
+ * The ID of the first item in the list.
76
+ */
77
+ first_id: string;
78
+
79
+ /**
80
+ * Whether there are more items available.
81
+ */
82
+ has_more: boolean;
83
+
84
+ /**
85
+ * The ID of the last item in the list.
86
+ */
87
+ last_id: string;
88
+
89
+ /**
90
+ * The type of object returned, must be `list`.
91
+ */
92
+ object: 'list';
93
+ }
94
+
95
+ export interface InputItemListParams extends CursorPageParams {
96
+ /**
97
+ * An item ID to list items before, used in pagination.
98
+ */
99
+ before?: string;
100
+
101
+ /**
102
+ * The order to return the input items in. Default is `asc`.
103
+ *
104
+ * - `asc`: Return the input items in ascending order.
105
+ * - `desc`: Return the input items in descending order.
106
+ */
107
+ order?: 'asc' | 'desc';
108
+ }
109
+
110
+ export declare namespace InputItems {
111
+ export { type ResponseItemList as ResponseItemList, type InputItemListParams as InputItemListParams };
112
+ }
113
+
114
+ export { ResponseItemsPage };