pub enum ResponseInputOutputItem {
Show 22 variants
Message {
id: String,
role: String,
content: Vec<ResponseContentPart>,
status: Option<String>,
phase: Option<MessagePhase>,
},
#[non_exhaustive] Reasoning {
id: String,
summary: Vec<SummaryTextContent>,
content: Vec<ResponseReasoningContent>,
encrypted_content: Option<String>,
status: Option<String>,
},
FunctionToolCall {
id: String,
call_id: String,
name: String,
arguments: String,
output: Option<String>,
status: Option<String>,
},
FunctionCallOutput {
id: Option<String>,
call_id: String,
output: String,
status: Option<String>,
},
McpApprovalRequest {
id: String,
server_label: String,
name: String,
arguments: String,
},
McpApprovalResponse {
id: Option<String>,
approval_request_id: String,
approve: bool,
reason: Option<String>,
},
ImageGenerationCall {
id: String,
action: Option<String>,
background: Option<String>,
output_format: Option<String>,
quality: Option<String>,
result: Option<String>,
revised_prompt: Option<String>,
size: Option<String>,
status: Option<ImageGenerationCallStatus>,
},
Compaction {
encrypted_content: String,
id: Option<String>,
},
ComputerCall {
id: String,
call_id: String,
action: Option<ComputerAction>,
actions: Option<Vec<ComputerAction>>,
status: ComputerCallStatus,
pending_safety_checks: Vec<ComputerSafetyCheck>,
},
ComputerCallOutput {
id: Option<String>,
call_id: String,
output: ComputerCallOutputContent,
acknowledged_safety_checks: Vec<ComputerSafetyCheck>,
status: Option<ComputerCallStatus>,
},
CustomToolCall {
call_id: String,
input: String,
name: String,
id: Option<String>,
namespace: Option<String>,
},
CustomToolCallOutput {
call_id: String,
output: CustomToolCallOutputContent,
id: Option<String>,
},
ShellCall {
action: ShellCallAction,
call_id: String,
id: Option<String>,
environment: Option<ShellCallEnvironment>,
status: Option<ShellCallStatus>,
created_by: Option<String>,
},
ShellCallOutput {
call_id: String,
output: Vec<ShellOutputChunk>,
id: Option<String>,
max_output_length: Option<u64>,
status: Option<ShellCallStatus>,
created_by: Option<String>,
},
ApplyPatchCall {
call_id: String,
operation: ApplyPatchOperation,
status: ApplyPatchCallStatus,
id: Option<String>,
},
ApplyPatchCallOutput {
call_id: String,
status: ApplyPatchCallOutputStatus,
id: Option<String>,
output: Option<String>,
},
LocalShellCall {
id: String,
call_id: String,
action: LocalShellExec,
status: LocalShellCallStatus,
},
LocalShellCallOutput {
id: String,
output: String,
status: Option<LocalShellCallStatus>,
},
McpCall {
id: String,
arguments: String,
name: String,
server_label: String,
approval_request_id: Option<String>,
error: Option<String>,
output: Option<String>,
status: Option<String>,
},
McpListTools {
id: String,
server_label: String,
tools: Vec<McpToolInfo>,
error: Option<String>,
},
SimpleInputMessage {
content: StringOrContentParts,
role: String,
type: Option<SimpleInputMessageTypeTag>,
phase: Option<MessagePhase>,
},
ItemReference {
id: String,
type: Option<ItemReferenceTypeTag>,
},
}Variants§
Message
Fields
content: Vec<ResponseContentPart>phase: Option<MessagePhase>Optional phase label, preserved from previous assistant output so gpt-5.3-codex+ multi-turn does not degrade (spec: ResponseOutputMessage.phase).
#[non_exhaustive]Reasoning
Fields
This variant is marked as non-exhaustive
summary: Vec<SummaryTextContent>content: Vec<ResponseReasoningContent>FunctionToolCall
Fields
FunctionCallOutput
McpApprovalRequest
McpApprovalResponse
ImageGenerationCall
type: "image_generation_call" — round-trip form for an image generated
in a prior turn. Spec (OpenAI Responses API, multi-turn image-edit
flow): clients may resubmit only { type, id } to reference a prior
generation by identifier, so result and status are accepted as
absent on the input side. The full shape is
{ id, action?, background?, output_format?, quality?, result?: base64, revised_prompt?, size?, status?, type }.
This mirrors the OpenAI Python SDK 2.8.x
response_input_item_param.ImageGenerationCall TypedDict: while the
TypedDict types those fields as Required[Optional[...]], the HTTP
API itself documents the id-only multi-turn reference form (see the
image-generation tool guide), and skip_serializing_if keeps the
serialized form spec-compatible when a full item is round-tripped.
The server-side ResponseOutputItem::ImageGenerationCall variant
carries the same metadata so real OpenAI responses
(action/background/output_format/quality/size) survive
cloud-passthrough and persistence round-trips.
The metadata fields (action, background, output_format,
quality, size) are typed as Option<String> rather than
narrow enums so unknown or future-added values pass through
unchanged — this mirrors ImageGenerationTool on the input-tool
side.
Fields
action: Option<String>"generate" | "edit" | "auto" — which image-generation action the
prior turn dispatched. Preserved free-form so future actions pass
through without a wire break.
background: Option<String>"transparent" | "opaque" | "auto". Matches the
image_generation tool input knob of the same name.
output_format: Option<String>"png" | "webp" | "jpeg". Matches the image_generation tool
input knob of the same name.
quality: Option<String>"auto" | "low" | "medium" | "high" | "standard" | "hd". Matches
the image_generation tool input knob of the same name.
revised_prompt: Option<String>Prompt text the mainline model rewrote before dispatching the image-generation call. Preserved so downstream turns/storage do not drop it on replay.
size: Option<String>"auto" | "1024x1024" | "1024x1536" | "1536x1024". Matches the
image_generation tool input knob of the same name.
status: Option<ImageGenerationCallStatus>Generation status. Omitted on id-only references.
Compaction
type: "compaction" — opaque compacted-history payload generated by
the /v1/responses/compact API. Spec
(openai-responses-api-spec.md §InputItemList L203-205):
Compaction { encrypted_content, type, id }. id is optional on the
input wire so newly-minted client-side compactions can omit it; it is
always present on items round-tripped from a previous response.
ComputerCall
{ type: "computer_call", id, call_id, action?, actions?, status, pending_safety_checks }.
Spec (openai-responses-api-spec.md §ComputerCall): single-action
action is the legacy shape; actions carries the flattened batch
for computer_use. Both fields are optional independently, so callers
can roundtrip either form.
Fields
action: Option<ComputerAction>actions: Option<Vec<ComputerAction>>status: ComputerCallStatuspending_safety_checks: Vec<ComputerSafetyCheck>Always serialized (including an empty []). The official OpenAI
Python SDK (openai==2.8.1,
types/responses/response_computer_tool_call.py) declares this as a
non-Optional List[PendingSafetyCheck], so the field must always
appear on the wire — an empty array is semantically distinct from
omitting the field.
ComputerCallOutput
{ type: "computer_call_output", id?, call_id, output, acknowledged_safety_checks?, status? }.
Spec (openai-responses-api-spec.md §ComputerCallOutput): output is the
ComputerCallOutputContent::ComputerScreenshot payload;
acknowledged_safety_checks and status are both optional per spec.
Fields
output: ComputerCallOutputContentacknowledged_safety_checks: Vec<ComputerSafetyCheck>status: Option<ComputerCallStatus>CustomToolCall
type: "custom_tool_call" — assistant’s call into a registered
custom tool. Spec: { call_id, input, name, type, id?, namespace? }.
id / namespace are modelled as Option<String> so newly-minted
client-side calls can omit them; they are populated on items
round-tripped from a previous response. input is the model’s
free-form payload (constrained by the tool’s format if grammar is
set); the client owns execution and replies with a matching
Self::CustomToolCallOutput.
CustomToolCallOutput
type: "custom_tool_call_output" — client’s response to a
custom_tool_call. Spec: { call_id, output, type, id? } (no
status field per spec — see Drift Log entry for T8). id is
Option<String> for the same reason as CustomToolCall.id above.
output is either a plain string or an array of input-typed content
parts (input_text / input_image / input_file).
ShellCall
type: "shell_call" — assistant’s call into the containerized
ResponseTool::Shell tool.
Spec (openai-responses-api-spec.md §ShellCall, L228-231) +
OpenAI SDK v2.8.1 ResponseFunctionShellToolCall:
{ action, call_id, type, id, environment, status, created_by? }.
id is Option<String> so newly-minted client-side calls can omit
it; the model populates it on items round-tripped from a previous
response. created_by carries provenance metadata the SDK types
as Optional[str] — present when the item was emitted by the
platform, absent on client-authored calls.
Fields
action: ShellCallActionenvironment: Option<ShellCallEnvironment>Resolved execution environment. Spec constrains this to
local or container_reference on the call form (see
ShellCallEnvironment docs).
status: Option<ShellCallStatus>ShellCallOutput
type: "shell_call_output" — client’s reply to a shell_call.
Spec (openai-responses-api-spec.md §ShellCallOutput, L233-238) +
OpenAI SDK v2.8.1 ResponseFunctionShellToolCallOutput:
{ call_id, output, type, id, max_output_length?, status, created_by? }.
id, max_output_length, and created_by are modelled as
Option per the SDK’s Optional[...] typing; the server populates
them on items round-tripped from a previous response.
ApplyPatchCall
type: "apply_patch_call" — model-issued file-edit request. Spec
(openai-responses-api-spec.md §ApplyPatchCall L240-L246):
{ call_id, operation, status, type, id }. id is Option<String>
so newly-minted client-side calls can omit it; it is always present on
items round-tripped from a previous response. The operation union is
CreateFile | DeleteFile | UpdateFile per
ApplyPatchOperation; the client owns execution (apply the diff on
disk) and replies with a matching Self::ApplyPatchCallOutput.
ApplyPatchCallOutput
type: "apply_patch_call_output" — client’s response to an
apply_patch_call. Spec (openai-responses-api-spec.md
§ApplyPatchCallOutput L248-L251): { call_id, status, type, id, output } where output is optional log text. id is
Option<String> for the same reason as ApplyPatchCall.id above;
output uses skip_serializing_if so a no-log success round-trips
without emitting an explicit null.
LocalShellCall
type: "local_shell_call" — assistant’s call into the
local_shell built-in tool. Spec
(openai-responses-api-spec.md §LocalShellCall L219-222):
{ id, action, call_id, status, type } where action is a
LocalShellExec payload describing the command to run on the
host. The client executes the command and replies with a
matching Self::LocalShellCallOutput.
LocalShellCallOutput
type: "local_shell_call_output" — client’s response to a
local_shell_call. Spec
(openai-responses-api-spec.md §LocalShellCallOutput L224-226):
{ id, output, type, status }. output is a single string
carrying the command’s serialized JSON output; status is
optional per SDK v2.8.1 (openai==2.8.1,
types/responses/response_input_item_param.py
LocalShellCallOutput — Optional on status).
McpCall
type: "mcp_call" — assistant-emitted hosted-MCP tool call replayed
as an input item for stateless multi-turn (store=false) flows.
Spec (openai-responses-api-spec.md §McpCall L264-266):
{ id, arguments, name, server_label, type, approval_request_id?, error?, output?, status? }.
Shape mirrors ResponseOutputItem::McpCall but approval_request_id,
error, output, and status are optional on the input side so
replay of an abridged or in-flight call (no output yet) stays
lossless. Matches OpenAI Python SDK 2.8.1
types/responses/response_input_item.py::McpCall.
Fields
McpListTools
type: "mcp_list_tools" — hosted-MCP server’s tool listing replayed
as an input item.
Spec (openai-responses-api-spec.md §McpListTools L253-255):
{ id, server_label, tools, type, error? } where each tools entry
is { input_schema, name, annotations?, description? }. Shape
mirrors ResponseOutputItem::McpListTools with error optional
per SDK v2.8.1
types/responses/response_input_item.py::McpListTools.
SimpleInputMessage
Fields
content: StringOrContentPartstype: Option<SimpleInputMessageTypeTag>Spec: EasyInputMessage.type is optional "message". Constrained
to a single-value tag enum so payloads with an unknown type
(e.g. "input_file", "totally_made_up") do not silently land
in this untagged catch-all variant — P5 fail-fast contract.
phase: Option<MessagePhase>Optional phase label (spec: EasyInputMessage.phase).
Preserved through conversation storage so gpt-5.3-codex+ does not lose the commentary/final_answer distinction across turns.
ItemReference
type: "item_reference" — pointer to a previously-stored item in the
active conversation. Spec (openai-responses-api-spec.md §InputItemList
L275-276): ItemReference { id, type } where type is
optional "item_reference". The variant is declared as
#[serde(untagged)] because the type discriminator is optional on
the wire; r#type is pinned to ItemReferenceTypeTag so payloads
whose type is not "item_reference" (e.g. "totally_made_up") do
not silently land in this catch-all variant — P5 fail-fast contract.
Declared AFTER Self::SimpleInputMessage so a {id, role, content}
payload (the id-carrying shape of SimpleInputMessage) still lands in
SimpleInputMessage first; only {id} / {id, type: "item_reference"}
payloads — which fail SimpleInputMessage’s required-field check —
fall through to this arm.
Backend resolution (router looks up id from conversation history and
substitutes the referenced item inline) is deferred to a future R
task; this variant only adds the schema surface.
Implementations§
Source§impl ResponseInputOutputItem
impl ResponseInputOutputItem
Sourcepub fn new_reasoning(
id: String,
summary: Vec<SummaryTextContent>,
content: Vec<ResponseReasoningContent>,
status: Option<String>,
) -> Self
pub fn new_reasoning( id: String, summary: Vec<SummaryTextContent>, content: Vec<ResponseReasoningContent>, status: Option<String>, ) -> Self
Create a new reasoning input/output item.
encrypted_content defaults to None; use
Self::new_reasoning_encrypted when round-tripping gpt-5 /
o-series encrypted reasoning.
Sourcepub fn new_reasoning_encrypted(
id: String,
summary: Vec<SummaryTextContent>,
content: Vec<ResponseReasoningContent>,
encrypted_content: String,
status: Option<String>,
) -> Self
pub fn new_reasoning_encrypted( id: String, summary: Vec<SummaryTextContent>, content: Vec<ResponseReasoningContent>, encrypted_content: String, status: Option<String>, ) -> Self
Create a new reasoning input/output item carrying an encrypted
reasoning payload. The encrypted_content must be the opaque
ciphertext.
Trait Implementations§
Source§impl Clone for ResponseInputOutputItem
impl Clone for ResponseInputOutputItem
Source§fn clone(&self) -> ResponseInputOutputItem
fn clone(&self) -> ResponseInputOutputItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResponseInputOutputItem
impl Debug for ResponseInputOutputItem
Source§impl<'de> Deserialize<'de> for ResponseInputOutputItem
impl<'de> Deserialize<'de> for ResponseInputOutputItem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ResponseInputOutputItem
impl JsonSchema for ResponseInputOutputItem
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more