Skip to content

Commit 6e772ae

Browse files
fix(api): align SDK response types with expanded item schemas
Fixes a variety of missing Items on Responses. OutputItem: add function_call_output, computer_tool_call_output, local_shell_call_output, mcp_approval_response, custom_tool_call_output ItemResource: add reasoning, compaction, custom_tool_call, custom_tool_call_output
1 parent cd72fba commit 6e772ae

13 files changed

+157
-14
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 152
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-13599f99dceef322e19171dcc63d90f638d225a445999442249e1ed7a4924c43.yml
3-
openapi_spec_hash: aac8cf8ec3c7dc6d14ecf5dbb289ee7c
4-
config_hash: 96fbf82cf74a44ccd513f5acf0956ffd
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-00994178cc8e20d71754b00c54b0e4f5b4128e1c1cce765e9b7d696bd8c80d33.yml
3+
openapi_spec_hash: 81f404053b663f987209b4fb2d08a230
4+
config_hash: 5635033cdc8c930255f8b529a78de722

src/openai/lib/_parsing/_responses.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,21 @@ def parse_response(
107107
or output.type == "compaction"
108108
or output.type == "mcp_call"
109109
or output.type == "mcp_approval_request"
110+
or output.type == "mcp_approval_response"
110111
or output.type == "image_generation_call"
111112
or output.type == "code_interpreter_call"
112113
or output.type == "local_shell_call"
114+
or output.type == "local_shell_call_output"
113115
or output.type == "shell_call"
114116
or output.type == "shell_call_output"
115117
or output.type == "apply_patch_call"
116118
or output.type == "apply_patch_call_output"
117119
or output.type == "mcp_list_tools"
118120
or output.type == "exec"
119121
or output.type == "custom_tool_call"
122+
or output.type == "function_call_output"
123+
or output.type == "computer_call_output"
124+
or output.type == "custom_tool_call_output"
120125
):
121126
output_list.append(output)
122127
elif TYPE_CHECKING: # type: ignore

src/openai/resources/responses/api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ from openai.types.responses import (
5353
ResponseCustomToolCall,
5454
ResponseCustomToolCallInputDeltaEvent,
5555
ResponseCustomToolCallInputDoneEvent,
56+
ResponseCustomToolCallItem,
5657
ResponseCustomToolCallOutput,
58+
ResponseCustomToolCallOutputItem,
5759
ResponseError,
5860
ResponseErrorEvent,
5961
ResponseFailedEvent,

src/openai/types/conversations/conversation_item.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ..._utils import PropertyInfo
88
from ..._models import BaseModel
99
from ..responses.response_reasoning_item import ResponseReasoningItem
10+
from ..responses.response_compaction_item import ResponseCompactionItem
1011
from ..responses.response_custom_tool_call import ResponseCustomToolCall
1112
from ..responses.response_tool_search_call import ResponseToolSearchCall
1213
from ..responses.response_computer_tool_call import ResponseComputerToolCall
@@ -234,6 +235,7 @@ class McpCall(BaseModel):
234235
ResponseToolSearchCall,
235236
ResponseToolSearchOutputItem,
236237
ResponseReasoningItem,
238+
ResponseCompactionItem,
237239
ResponseCodeInterpreterToolCall,
238240
LocalShellCall,
239241
LocalShellCallOutput,

src/openai/types/responses/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
from .web_search_preview_tool_param import WebSearchPreviewToolParam as WebSearchPreviewToolParam
143143
from .response_apply_patch_tool_call import ResponseApplyPatchToolCall as ResponseApplyPatchToolCall
144144
from .response_compaction_item_param import ResponseCompactionItemParam as ResponseCompactionItemParam
145+
from .response_custom_tool_call_item import ResponseCustomToolCallItem as ResponseCustomToolCallItem
145146
from .response_file_search_tool_call import ResponseFileSearchToolCall as ResponseFileSearchToolCall
146147
from .response_mcp_call_failed_event import ResponseMcpCallFailedEvent as ResponseMcpCallFailedEvent
147148
from .computer_use_preview_tool_param import ComputerUsePreviewToolParam as ComputerUsePreviewToolParam
@@ -179,6 +180,7 @@
179180
from .response_audio_transcript_delta_event import (
180181
ResponseAudioTranscriptDeltaEvent as ResponseAudioTranscriptDeltaEvent,
181182
)
183+
from .response_custom_tool_call_output_item import ResponseCustomToolCallOutputItem as ResponseCustomToolCallOutputItem
182184
from .container_network_policy_domain_secret import (
183185
ContainerNetworkPolicyDomainSecret as ContainerNetworkPolicyDomainSecret,
184186
)

src/openai/types/responses/parsed_response.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
LocalShellCall,
1313
McpApprovalRequest,
1414
ImageGenerationCall,
15+
McpApprovalResponse,
1516
LocalShellCallAction,
17+
LocalShellCallOutput,
1618
)
1719
from .response_output_text import ResponseOutputText
1820
from .response_output_message import ResponseOutputMessage
@@ -30,6 +32,9 @@
3032
from .response_function_shell_tool_call import ResponseFunctionShellToolCall
3133
from .response_code_interpreter_tool_call import ResponseCodeInterpreterToolCall
3234
from .response_apply_patch_tool_call_output import ResponseApplyPatchToolCallOutput
35+
from .response_custom_tool_call_output_item import ResponseCustomToolCallOutputItem
36+
from .response_computer_tool_call_output_item import ResponseComputerToolCallOutputItem
37+
from .response_function_tool_call_output_item import ResponseFunctionToolCallOutputItem
3338
from .response_function_shell_tool_call_output import ResponseFunctionShellToolCallOutput
3439

3540
__all__ = ["ParsedResponse", "ParsedResponseOutputMessage", "ParsedResponseOutputText"]
@@ -72,22 +77,27 @@ class ParsedResponseFunctionToolCall(ResponseFunctionToolCall):
7277
ResponseFileSearchToolCall,
7378
ResponseFunctionWebSearch,
7479
ResponseComputerToolCall,
80+
ResponseComputerToolCallOutputItem,
7581
ResponseToolSearchCall,
7682
ResponseToolSearchOutputItem,
7783
ResponseReasoningItem,
7884
McpCall,
7985
McpApprovalRequest,
86+
McpApprovalResponse,
8087
ImageGenerationCall,
8188
LocalShellCall,
89+
LocalShellCallOutput,
8290
LocalShellCallAction,
8391
McpListTools,
8492
ResponseCodeInterpreterToolCall,
85-
ResponseCustomToolCall,
8693
ResponseCompactionItem,
8794
ResponseFunctionShellToolCall,
8895
ResponseFunctionShellToolCallOutput,
8996
ResponseApplyPatchToolCall,
9097
ResponseApplyPatchToolCallOutput,
98+
ResponseFunctionToolCallOutputItem,
99+
ResponseCustomToolCall,
100+
ResponseCustomToolCallOutputItem,
91101
],
92102
PropertyInfo(discriminator="type"),
93103
]

src/openai/types/responses/response_computer_tool_call_output_item.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ class ResponseComputerToolCallOutputItem(BaseModel):
3232
output: ResponseComputerToolCallOutputScreenshot
3333
"""A computer screenshot image used with the computer use tool."""
3434

35+
status: Literal["completed", "incomplete", "failed", "in_progress"]
36+
"""The status of the message input.
37+
38+
One of `in_progress`, `completed`, or `incomplete`. Populated when input items
39+
are returned via API.
40+
"""
41+
3542
type: Literal["computer_call_output"]
3643
"""The type of the computer tool call output. Always `computer_call_output`."""
3744

@@ -41,9 +48,5 @@ class ResponseComputerToolCallOutputItem(BaseModel):
4148
developer.
4249
"""
4350

44-
status: Optional[Literal["in_progress", "completed", "incomplete"]] = None
45-
"""The status of the message input.
46-
47-
One of `in_progress`, `completed`, or `incomplete`. Populated when input items
48-
are returned via API.
49-
"""
51+
created_by: Optional[str] = None
52+
"""The identifier of the actor that created the item."""
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from .response_custom_tool_call import ResponseCustomToolCall
7+
8+
__all__ = ["ResponseCustomToolCallItem"]
9+
10+
11+
class ResponseCustomToolCallItem(ResponseCustomToolCall):
12+
"""A call to a custom tool created by the model."""
13+
14+
id: str # type: ignore
15+
"""The unique ID of the custom tool call item."""
16+
17+
status: Literal["in_progress", "completed", "incomplete"]
18+
"""The status of the item.
19+
20+
One of `in_progress`, `completed`, or `incomplete`. Populated when items are
21+
returned via API.
22+
"""
23+
24+
created_by: Optional[str] = None
25+
"""The identifier of the actor that created the item."""
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from .response_custom_tool_call_output import ResponseCustomToolCallOutput
7+
8+
__all__ = ["ResponseCustomToolCallOutputItem"]
9+
10+
11+
class ResponseCustomToolCallOutputItem(ResponseCustomToolCallOutput):
12+
"""The output of a custom tool call from your code, being sent back to the model."""
13+
14+
id: str # type: ignore
15+
"""The unique ID of the custom tool call output item."""
16+
17+
status: Literal["in_progress", "completed", "incomplete"]
18+
"""The status of the item.
19+
20+
One of `in_progress`, `completed`, or `incomplete`. Populated when items are
21+
returned via API.
22+
"""
23+
24+
created_by: Optional[str] = None
25+
"""The identifier of the actor that created the item."""

src/openai/types/responses/response_function_tool_call_item.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from typing import Optional
4+
from typing_extensions import Literal
5+
36
from .response_function_tool_call import ResponseFunctionToolCall
47

58
__all__ = ["ResponseFunctionToolCallItem"]
@@ -14,3 +17,13 @@ class ResponseFunctionToolCallItem(ResponseFunctionToolCall):
1417

1518
id: str # type: ignore
1619
"""The unique ID of the function tool call."""
20+
21+
status: Literal["in_progress", "completed", "incomplete"] # type: ignore
22+
"""The status of the item.
23+
24+
One of `in_progress`, `completed`, or `incomplete`. Populated when items are
25+
returned via API.
26+
"""
27+
28+
created_by: Optional[str] = None
29+
"""The identifier of the actor that created the item."""

0 commit comments

Comments
 (0)