pub enum ResponseOutputItem {
Show 19 variants
Message {
id: String,
role: String,
content: Vec<ResponseContentPart>,
status: String,
phase: Option<MessagePhase>,
},
#[non_exhaustive] Reasoning {
id: String,
summary: Vec<SummaryTextContent>,
content: Vec<ResponseReasoningContent>,
encrypted_content: Option<String>,
status: Option<String>,
},
FunctionToolCall {
id: Option<String>,
call_id: String,
name: String,
arguments: String,
output: Option<String>,
status: String,
},
McpListTools {
id: String,
server_label: String,
tools: Vec<McpToolInfo>,
error: Option<String>,
},
McpCall {
id: String,
status: String,
approval_request_id: Option<String>,
arguments: String,
error: Option<McpToolCallError>,
name: String,
output: String,
server_label: String,
},
McpApprovalRequest {
id: String,
server_label: String,
name: String,
arguments: String,
},
WebSearchCall {
id: String,
status: WebSearchCallStatus,
action: WebSearchAction,
results: Option<Vec<WebSearchResult>>,
},
CodeInterpreterCall {
id: String,
status: CodeInterpreterCallStatus,
container_id: String,
code: Option<String>,
outputs: Option<Vec<CodeInterpreterOutput>>,
},
FileSearchCall {
id: String,
status: FileSearchCallStatus,
queries: Vec<String>,
results: Option<Vec<FileSearchResult>>,
},
ImageGenerationCall {
id: String,
action: Option<String>,
background: Option<String>,
output_format: Option<String>,
quality: Option<String>,
result: String,
revised_prompt: Option<String>,
size: Option<String>,
status: ImageGenerationCallStatus,
},
Compaction {
id: String,
encrypted_content: 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>,
},
ShellCall {
id: String,
call_id: String,
action: ShellCallAction,
environment: Option<ResponseShellCallEnvironment>,
status: ShellCallStatus,
created_by: Option<String>,
},
ShellCallOutput {
id: String,
call_id: String,
output: Vec<ShellOutputChunk>,
max_output_length: Option<u64>,
status: ShellCallStatus,
created_by: Option<String>,
},
ApplyPatchCall {
id: String,
call_id: String,
operation: ApplyPatchOperation,
status: ApplyPatchCallStatus,
},
ApplyPatchCallOutput {
id: String,
call_id: String,
status: ApplyPatchCallOutputStatus,
output: Option<String>,
},
LocalShellCall {
id: String,
call_id: String,
action: LocalShellExec,
status: LocalShellCallStatus,
},
LocalShellCallOutput {
id: String,
output: String,
status: Option<LocalShellCallStatus>,
},
}Variants§
Message
Fields
content: Vec<ResponseContentPart>phase: Option<MessagePhase>Optional phase label (spec: ResponseOutputMessage.phase).
Labels assistant messages; for gpt-5.3-codex+ we must preserve and resend this on subsequent turns to avoid perf degradation.
#[non_exhaustive]Reasoning
Fields
This variant is marked as non-exhaustive
summary: Vec<SummaryTextContent>content: Vec<ResponseReasoningContent>FunctionToolCall
Fields
McpListTools
Fields
tools: Vec<McpToolInfo>McpCall
Fields
error: Option<McpToolCallError>McpApprovalRequest
WebSearchCall
Fields
status: WebSearchCallStatusaction: WebSearchActionresults: Option<Vec<WebSearchResult>>Search hits surfaced when callers request web_search_call.results
via the top-level include[] array. Mirrors the file_search_call.results
shape — array of typed entries when populated, omitted otherwise so the
default wire shape ({id, action, status, type}) stays spec-byte-identical.
CodeInterpreterCall
FileSearchCall
ImageGenerationCall
type: "image_generation_call" — output item carrying a base64 image
produced by the image_generation built-in tool. Spec:
{ id, action?, background?, output_format?, quality?, result: base64, revised_prompt?, size?, status, type }.
Real OpenAI production responses include the five metadata fields
(action, background, output_format, quality, size) even
though the OpenAI Rust SDK v2.8.1 omits them. We carry them as
Option<String> so cloud passthrough and persistence round-trips
preserve them verbatim — and so downstream consumers can read them
without a second round-trip to the provider.
The metadata fields 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
this call dispatched. Preserved free-form so future actions pass
through without a wire break.
background: Option<String>"transparent" | "opaque" | "auto". Mirrors the
image_generation tool input knob of the same name.
output_format: Option<String>"png" | "webp" | "jpeg". Mirrors the image_generation tool
input knob of the same name.
quality: Option<String>"auto" | "low" | "medium" | "high" | "standard" | "hd". Mirrors
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". Mirrors the
image_generation tool input knob of the same name.
status: ImageGenerationCallStatusCompaction
type: "compaction" — server-emitted item carrying an opaque
compacted-history payload. Spec
(openai-responses-api-spec.md §InputItemList L203-205,
§output: array of ResponseOutputItem): { encrypted_content, type, id }.
id is required on the output wire because the server always assigns
one when emitting the compaction item.
ComputerCall
{ type: "computer_call", id, call_id, action?, actions?, status, pending_safety_checks }.
Spec (openai-responses-api-spec.md §ComputerCall): output-side mirror of
the input variant — emitted when the model issues a computer-use action.
See ComputerAction.
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).
Fields
output: ComputerCallOutputContentacknowledged_safety_checks: Vec<ComputerSafetyCheck>status: Option<ComputerCallStatus>ShellCall
type: "shell_call" — output-side mirror of the input variant.
Spec (openai-responses-api-spec.md §ShellCall, L228-231 and §returns
L512-513) + OpenAI SDK v2.8.1 ResponseFunctionShellToolCall:
emitted when the model issues a containerized shell action. The
environment echoed back is restricted to local /
container_reference via ResponseShellCallEnvironment — per spec
L513 the response form uses ResponseLocalEnvironment { type: "local" }
only.
id and status are required on the output wire — the SDK types
them as non-Optional on ResponseFunctionShellToolCall, mirroring
the ComputerCall treatment above. created_by is the SDK’s
Optional[str] provenance tag, populated when the platform stamps
the item.
Fields
action: ShellCallActionenvironment: Option<ResponseShellCallEnvironment>status: ShellCallStatusShellCallOutput
type: "shell_call_output" — output-side mirror of the input
variant.
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? }.
Emitted when the platform surfaces captured stdout/stderr plus an
ShellOutcome for a prior shell call.
id and status are required per the SDK’s non-Optional typing.
max_output_length is Optional[int] in the SDK (the platform may
emit shell outputs when the originating shell_call.action did not
specify a cap) and created_by is Optional[str] — both dropped at
serialize time when absent so downstream consumers do not see null
placeholders.
ApplyPatchCall
type: "apply_patch_call" — server-emitted mirror of the input
variant. Spec (openai-responses-api-spec.md §ApplyPatchCall L240-L246):
{ call_id, operation, status, type, id }. id is required on the
output wire because the server always assigns one when emitting the
apply_patch call item.
ApplyPatchCallOutput
type: "apply_patch_call_output" — server-emitted mirror of the
input variant. Spec (openai-responses-api-spec.md
§ApplyPatchCallOutput L248-L251): { call_id, status, type, id, output }. id is required on the output wire; output is optional
log text surfaced by the upstream apply_patch executor.
LocalShellCall
type: "local_shell_call" — output-side mirror of the input
variant — emitted when the model issues a local_shell tool call.
Spec (openai-responses-api-spec.md §LocalShellCall L219-222):
{ id, action, call_id, status, type } with action as a
LocalShellExec payload. See ResponseInputOutputItem::LocalShellCall.
LocalShellCallOutput
type: "local_shell_call_output" — output-side mirror of the
input variant. Spec
(openai-responses-api-spec.md §LocalShellCallOutput L224-226):
{ id, output, type, status } with status optional per SDK
v2.8.1. See ResponseInputOutputItem::LocalShellCallOutput.
Implementations§
Source§impl ResponseOutputItem
impl ResponseOutputItem
Sourcepub fn new_message(
id: String,
role: String,
content: Vec<ResponseContentPart>,
status: String,
) -> Self
pub fn new_message( id: String, role: String, content: Vec<ResponseContentPart>, status: String, ) -> Self
Create a new message output item (no phase).
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 output item.
encrypted_content defaults to None; use
Self::new_reasoning_encrypted when carrying 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 output item carrying an encrypted reasoning payload.
The encrypted_content must be the opaque ciphertext; a None value
would defeat the purpose of the _encrypted constructor — callers
without ciphertext should use Self::new_reasoning instead.
Trait Implementations§
Source§impl Clone for ResponseOutputItem
impl Clone for ResponseOutputItem
Source§fn clone(&self) -> ResponseOutputItem
fn clone(&self) -> ResponseOutputItem
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 ResponseOutputItem
impl Debug for ResponseOutputItem
Source§impl<'de> Deserialize<'de> for ResponseOutputItem
impl<'de> Deserialize<'de> for ResponseOutputItem
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 ResponseOutputItem
impl JsonSchema for ResponseOutputItem
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 inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more