diff --git a/src/openai/types/beta/beta_response_steer_input_param.py b/src/openai/types/beta/beta_response_steer_input_param.py index 002369514d..75f1b34b3c 100644 --- a/src/openai/types/beta/beta_response_steer_input_param.py +++ b/src/openai/types/beta/beta_response_steer_input_param.py @@ -2,32 +2,18 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict from .beta_response_steer_input_content_param import BetaResponseSteerInputContentParam -from .beta_response_function_call_output_item_list_param import BetaResponseFunctionCallOutputItemListParam __all__ = [ "BetaResponseSteerInputParam", "ResponseSteerInputItemList", "ResponseSteerInputItemListMessage", - "ResponseSteerInputItemListMessageAgent", - "ResponseSteerInputItemListFunctionCallOutput", - "ResponseSteerInputItemListFunctionCallOutputAgent", - "ResponseSteerInputItemListFunctionCallOutputCaller", - "ResponseSteerInputItemListFunctionCallOutputCallerDirect", - "ResponseSteerInputItemListFunctionCallOutputCallerProgram", ] -class ResponseSteerInputItemListMessageAgent(TypedDict, total=False): - """The agent that produced this item.""" - - agent_name: Required[str] - """The canonical name of the agent that produced this item.""" - - class ResponseSteerInputItemListMessage(TypedDict, total=False): content: Required[Union[Iterable[BetaResponseSteerInputContentParam], str]] """The message content, as an array of content parts.""" @@ -35,84 +21,10 @@ class ResponseSteerInputItemListMessage(TypedDict, total=False): role: Required[Literal["user"]] """The message role. Always `user`.""" - type: Required[Literal["message"]] - """The item type. Always `message`.""" - - id: Optional[str] - """The unique ID of this message item.""" - - agent: Optional[ResponseSteerInputItemListMessageAgent] - """The agent that produced this item.""" - - status: Optional[str] - """The status of the message item.""" - - -class ResponseSteerInputItemListFunctionCallOutputAgent(TypedDict, total=False): - """The agent that produced this item.""" + type: Literal["message"] + """The optional item type. When provided, always `message`.""" - agent_name: Required[str] - """The canonical name of the agent that produced this item.""" - - -class ResponseSteerInputItemListFunctionCallOutputCallerDirect(TypedDict, total=False): - type: Required[Literal["direct"]] - """The caller type. Always `direct`.""" - - -class ResponseSteerInputItemListFunctionCallOutputCallerProgram(TypedDict, total=False): - caller_id: Required[str] - """The call ID of the program item that produced this tool call.""" - - type: Required[Literal["program"]] - """The caller type. Always `program`.""" - - -ResponseSteerInputItemListFunctionCallOutputCaller: TypeAlias = Union[ - ResponseSteerInputItemListFunctionCallOutputCallerDirect, ResponseSteerInputItemListFunctionCallOutputCallerProgram -] - -class ResponseSteerInputItemListFunctionCallOutput(TypedDict, total=False): - """The output of a function tool call.""" - - output: Required[Union[str, BetaResponseFunctionCallOutputItemListParam]] - """Text, image, or file output of the function tool call.""" - - type: Required[Literal["function_call_output"]] - """The type of the function tool call output. Always `function_call_output`.""" - - id: Optional[str] - """The unique ID of the function tool call output. - - Populated when this item is returned via API. - """ - - agent: Optional[ResponseSteerInputItemListFunctionCallOutputAgent] - """The agent that produced this item.""" - - call_id: Optional[str] - """The unique ID of the function tool call generated by the model.""" - - caller: Optional[ResponseSteerInputItemListFunctionCallOutputCaller] - """The execution context that produced this tool call.""" - - name: Optional[str] - """The name of the tool that produced the output.""" - - namespace: Optional[str] - """The namespace of the tool that produced the output.""" - - status: Optional[Literal["in_progress", "completed", "incomplete"]] - """The status of the item. - - One of `in_progress`, `completed`, or `incomplete`. Populated when items are - returned via API. - """ - - -ResponseSteerInputItemList: TypeAlias = Union[ - ResponseSteerInputItemListMessage, ResponseSteerInputItemListFunctionCallOutput -] +ResponseSteerInputItemList: TypeAlias = ResponseSteerInputItemListMessage BetaResponseSteerInputParam: TypeAlias = Union[str, Iterable[ResponseSteerInputItemList]] diff --git a/src/openai/types/responses/response_steer_input_param.py b/src/openai/types/responses/response_steer_input_param.py index dcaa31df0e..5e3ea61700 100644 --- a/src/openai/types/responses/response_steer_input_param.py +++ b/src/openai/types/responses/response_steer_input_param.py @@ -2,20 +2,15 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict from .response_steer_input_content_param import ResponseSteerInputContentParam -from .response_function_call_output_item_list_param import ResponseFunctionCallOutputItemListParam __all__ = [ "ResponseSteerInputParam", "ResponseSteerInputItemList", "ResponseSteerInputItemListMessage", - "ResponseSteerInputItemListFunctionCallOutput", - "ResponseSteerInputItemListFunctionCallOutputCaller", - "ResponseSteerInputItemListFunctionCallOutputCallerDirect", - "ResponseSteerInputItemListFunctionCallOutputCallerProgram", ] @@ -26,71 +21,10 @@ class ResponseSteerInputItemListMessage(TypedDict, total=False): role: Required[Literal["user"]] """The message role. Always `user`.""" - type: Required[Literal["message"]] - """The item type. Always `message`.""" + type: Literal["message"] + """The optional item type. When provided, always `message`.""" - id: Optional[str] - """The unique ID of this message item.""" - status: Optional[str] - """The status of the message item.""" - - -class ResponseSteerInputItemListFunctionCallOutputCallerDirect(TypedDict, total=False): - type: Required[Literal["direct"]] - """The caller type. Always `direct`.""" - - -class ResponseSteerInputItemListFunctionCallOutputCallerProgram(TypedDict, total=False): - caller_id: Required[str] - """The call ID of the program item that produced this tool call.""" - - type: Required[Literal["program"]] - """The caller type. Always `program`.""" - - -ResponseSteerInputItemListFunctionCallOutputCaller: TypeAlias = Union[ - ResponseSteerInputItemListFunctionCallOutputCallerDirect, ResponseSteerInputItemListFunctionCallOutputCallerProgram -] - - -class ResponseSteerInputItemListFunctionCallOutput(TypedDict, total=False): - """The output of a function tool call.""" - - output: Required[Union[str, ResponseFunctionCallOutputItemListParam]] - """Text, image, or file output of the function tool call.""" - - type: Required[Literal["function_call_output"]] - """The type of the function tool call output. Always `function_call_output`.""" - - id: Optional[str] - """The unique ID of the function tool call output. - - Populated when this item is returned via API. - """ - - call_id: Optional[str] - """The unique ID of the function tool call generated by the model.""" - - caller: Optional[ResponseSteerInputItemListFunctionCallOutputCaller] - """The execution context that produced this tool call.""" - - name: Optional[str] - """The name of the tool that produced the output.""" - - namespace: Optional[str] - """The namespace of the tool that produced the output.""" - - status: Optional[Literal["in_progress", "completed", "incomplete"]] - """The status of the item. - - One of `in_progress`, `completed`, or `incomplete`. Populated when items are - returned via API. - """ - - -ResponseSteerInputItemList: TypeAlias = Union[ - ResponseSteerInputItemListMessage, ResponseSteerInputItemListFunctionCallOutput -] +ResponseSteerInputItemList: TypeAlias = ResponseSteerInputItemListMessage ResponseSteerInputParam: TypeAlias = Union[str, Iterable[ResponseSteerInputItemList]] diff --git a/tests/test_response_steer_input_types.py b/tests/test_response_steer_input_types.py new file mode 100644 index 0000000000..6d90acec7e --- /dev/null +++ b/tests/test_response_steer_input_types.py @@ -0,0 +1,20 @@ +from openai.types.beta import beta_response_steer_input_param as beta_steer_param +from openai.types.responses import response_steer_input_param as steer_param + + +def test_stable_steer_params_match_wire_contract() -> None: + message = steer_param.ResponseSteerInputItemListMessage + + assert set(message.__annotations__) == {"content", "role", "type"} + assert set(message.__required_keys__) == {"content", "role"} + assert steer_param.ResponseSteerInputItemList is message + assert "ResponseSteerInputItemListFunctionCallOutput" not in steer_param.__all__ + + +def test_beta_steer_params_match_wire_contract() -> None: + message = beta_steer_param.ResponseSteerInputItemListMessage + + assert set(message.__annotations__) == {"content", "role", "type"} + assert set(message.__required_keys__) == {"content", "role"} + assert beta_steer_param.ResponseSteerInputItemList is message + assert "ResponseSteerInputItemListFunctionCallOutput" not in beta_steer_param.__all__