From df822c77a4682b63ddb43e61d94ff21e19218fea Mon Sep 17 00:00:00 2001 From: weed33834 Date: Sat, 8 Aug 2026 00:16:01 +0000 Subject: [PATCH] fix(types): make id and status optional in ResponseOutputMessageParam When sending a client-authored assistant message via the Responses API (e.g. replayed from storage, edited, or produced by other code), the caller has no OpenAI message id or status. Previously the type system required both fields, forcing developers to fabricate fake values or use `# type: ignore`. This change makes `id` and `status` Optional in both `ResponseOutputMessageParam` and `BetaResponseOutputMessageParam`, consistent with other input item types (e.g. `ComputerCallOutput`, `FunctionCallOutput`, `ShellCall`) which already use `Optional[str]` for these fields. Fixes #3544 --- .../types/beta/beta_response_output_message_param.py | 9 ++++++--- .../types/responses/response_output_message_param.py | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/openai/types/beta/beta_response_output_message_param.py b/src/openai/types/beta/beta_response_output_message_param.py index 834a4bb1ca..a2a4687273 100644 --- a/src/openai/types/beta/beta_response_output_message_param.py +++ b/src/openai/types/beta/beta_response_output_message_param.py @@ -23,8 +23,11 @@ class Agent(TypedDict, total=False): class BetaResponseOutputMessageParam(TypedDict, total=False): """An output message from the model.""" - id: Required[str] - """The unique ID of the output message.""" + id: Optional[str] + """The unique ID of the output message. + + Populated when this item is returned via API. + """ content: Required[Iterable[Content]] """The content of the output message.""" @@ -32,7 +35,7 @@ class BetaResponseOutputMessageParam(TypedDict, total=False): role: Required[Literal["assistant"]] """The role of the output message. Always `assistant`.""" - status: Required[Literal["in_progress", "completed", "incomplete"]] + status: Optional[Literal["in_progress", "completed", "incomplete"]] """The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items diff --git a/src/openai/types/responses/response_output_message_param.py b/src/openai/types/responses/response_output_message_param.py index 09fec5bd58..70814b0818 100644 --- a/src/openai/types/responses/response_output_message_param.py +++ b/src/openai/types/responses/response_output_message_param.py @@ -16,8 +16,11 @@ class ResponseOutputMessageParam(TypedDict, total=False): """An output message from the model.""" - id: Required[str] - """The unique ID of the output message.""" + id: Optional[str] + """The unique ID of the output message. + + Populated when this item is returned via API. + """ content: Required[Iterable[Content]] """The content of the output message.""" @@ -25,7 +28,7 @@ class ResponseOutputMessageParam(TypedDict, total=False): role: Required[Literal["assistant"]] """The role of the output message. Always `assistant`.""" - status: Required[Literal["in_progress", "completed", "incomplete"]] + status: Optional[Literal["in_progress", "completed", "incomplete"]] """The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items