Skip to content

Commit e5ea4a7

Browse files
fix(types): improve responses type names (#1392)
1 parent 0ad2fe0 commit e5ea4a7

File tree

5 files changed

+183
-232
lines changed

5 files changed

+183
-232
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 81
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f763c1a35c8b9b02f1e31b9b2e09e21f98bfe8413e5079c86cbb07da2dd7779b.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f3bce04386c4fcfd5037e0477fbaa39010003fd1558eb5185fe4a71dd6a05fdd.yml

api.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ Types:
532532
- <code><a href="./src/resources/responses/responses.ts">ResponseCodeInterpreterToolCall</a></code>
533533
- <code><a href="./src/resources/responses/responses.ts">ResponseCompletedEvent</a></code>
534534
- <code><a href="./src/resources/responses/responses.ts">ResponseComputerToolCall</a></code>
535+
- <code><a href="./src/resources/responses/responses.ts">ResponseComputerToolCallOutputItem</a></code>
536+
- <code><a href="./src/resources/responses/responses.ts">ResponseComputerToolCallOutputScreenshot</a></code>
535537
- <code><a href="./src/resources/responses/responses.ts">ResponseContent</a></code>
536538
- <code><a href="./src/resources/responses/responses.ts">ResponseContentPartAddedEvent</a></code>
537539
- <code><a href="./src/resources/responses/responses.ts">ResponseContentPartDoneEvent</a></code>
@@ -548,6 +550,8 @@ Types:
548550
- <code><a href="./src/resources/responses/responses.ts">ResponseFunctionCallArgumentsDeltaEvent</a></code>
549551
- <code><a href="./src/resources/responses/responses.ts">ResponseFunctionCallArgumentsDoneEvent</a></code>
550552
- <code><a href="./src/resources/responses/responses.ts">ResponseFunctionToolCall</a></code>
553+
- <code><a href="./src/resources/responses/responses.ts">ResponseFunctionToolCallItem</a></code>
554+
- <code><a href="./src/resources/responses/responses.ts">ResponseFunctionToolCallOutputItem</a></code>
551555
- <code><a href="./src/resources/responses/responses.ts">ResponseFunctionWebSearch</a></code>
552556
- <code><a href="./src/resources/responses/responses.ts">ResponseInProgressEvent</a></code>
553557
- <code><a href="./src/resources/responses/responses.ts">ResponseIncludable</a></code>
@@ -559,7 +563,9 @@ Types:
559563
- <code><a href="./src/resources/responses/responses.ts">ResponseInputImage</a></code>
560564
- <code><a href="./src/resources/responses/responses.ts">ResponseInputItem</a></code>
561565
- <code><a href="./src/resources/responses/responses.ts">ResponseInputMessageContentList</a></code>
566+
- <code><a href="./src/resources/responses/responses.ts">ResponseInputMessageItem</a></code>
562567
- <code><a href="./src/resources/responses/responses.ts">ResponseInputText</a></code>
568+
- <code><a href="./src/resources/responses/responses.ts">ResponseItem</a></code>
563569
- <code><a href="./src/resources/responses/responses.ts">ResponseOutputAudio</a></code>
564570
- <code><a href="./src/resources/responses/responses.ts">ResponseOutputItem</a></code>
565571
- <code><a href="./src/resources/responses/responses.ts">ResponseOutputItemAddedEvent</a></code>
@@ -600,4 +606,4 @@ Types:
600606

601607
Methods:
602608

603-
- <code title="get /responses/{response_id}/input_items">client.responses.inputItems.<a href="./src/resources/responses/input-items.ts">list</a>(responseId, { ...params }) -> ResponseItemListDataPage</code>
609+
- <code title="get /responses/{response_id}/input_items">client.responses.inputItems.<a href="./src/resources/responses/input-items.ts">list</a>(responseId, { ...params }) -> ResponseItemsPage</code>

src/resources/responses/index.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

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';
94
export { Responses } from './responses';

src/resources/responses/input-items.ts

+10-199
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { APIResource } from '../../resource';
44
import { isRequestOptions } from '../../core';
55
import * as Core from '../../core';
66
import * as ResponsesAPI from './responses';
7-
import { CursorPage, type CursorPageParams } from '../../pagination';
7+
import { ResponseItemsPage } from './responses';
8+
import { type CursorPageParams } from '../../pagination';
89

910
export class InputItems extends APIResource {
1011
/**
@@ -14,84 +15,34 @@ export class InputItems extends APIResource {
1415
responseId: string,
1516
query?: InputItemListParams,
1617
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>;
2819
list(
2920
responseId: string,
3021
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>;
4223
list(
4324
responseId: string,
4425
query: InputItemListParams | Core.RequestOptions = {},
4526
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> {
5728
if (isRequestOptions(query)) {
5829
return this.list(responseId, {}, query);
5930
}
60-
return this._client.getAPIList(`/responses/${responseId}/input_items`, ResponseItemListDataPage, {
31+
return this._client.getAPIList(`/responses/${responseId}/input_items`, ResponseItemsPage, {
6132
query,
6233
...options,
6334
});
6435
}
6536
}
6637

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-
7838
/**
7939
* A list of Response items.
8040
*/
8141
export interface ResponseItemList {
8242
/**
8343
* A list of items used to generate this response.
8444
*/
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>;
9546

9647
/**
9748
* The ID of the first item in the list.
@@ -114,142 +65,6 @@ export interface ResponseItemList {
11465
object: 'list';
11566
}
11667

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-
25368
export interface InputItemListParams extends CursorPageParams {
25469
/**
25570
* An item ID to list items before, used in pagination.
@@ -265,12 +80,8 @@ export interface InputItemListParams extends CursorPageParams {
26580
order?: 'asc' | 'desc';
26681
}
26782

268-
InputItems.ResponseItemListDataPage = ResponseItemListDataPage;
269-
27083
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 };
27685
}
86+
87+
export { ResponseItemsPage };

0 commit comments

Comments
 (0)