Skip to content

Commit df822c7

Browse files
committed
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
1 parent 0c09a3f commit df822c7

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/openai/types/beta/beta_response_output_message_param.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ class Agent(TypedDict, total=False):
2323
class BetaResponseOutputMessageParam(TypedDict, total=False):
2424
"""An output message from the model."""
2525

26-
id: Required[str]
27-
"""The unique ID of the output message."""
26+
id: Optional[str]
27+
"""The unique ID of the output message.
28+
29+
Populated when this item is returned via API.
30+
"""
2831

2932
content: Required[Iterable[Content]]
3033
"""The content of the output message."""
3134

3235
role: Required[Literal["assistant"]]
3336
"""The role of the output message. Always `assistant`."""
3437

35-
status: Required[Literal["in_progress", "completed", "incomplete"]]
38+
status: Optional[Literal["in_progress", "completed", "incomplete"]]
3639
"""The status of the message input.
3740
3841
One of `in_progress`, `completed`, or `incomplete`. Populated when input items

src/openai/types/responses/response_output_message_param.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@
1616
class ResponseOutputMessageParam(TypedDict, total=False):
1717
"""An output message from the model."""
1818

19-
id: Required[str]
20-
"""The unique ID of the output message."""
19+
id: Optional[str]
20+
"""The unique ID of the output message.
21+
22+
Populated when this item is returned via API.
23+
"""
2124

2225
content: Required[Iterable[Content]]
2326
"""The content of the output message."""
2427

2528
role: Required[Literal["assistant"]]
2629
"""The role of the output message. Always `assistant`."""
2730

28-
status: Required[Literal["in_progress", "completed", "incomplete"]]
31+
status: Optional[Literal["in_progress", "completed", "incomplete"]]
2932
"""The status of the message input.
3033
3134
One of `in_progress`, `completed`, or `incomplete`. Populated when input items

0 commit comments

Comments
 (0)