Skip to main content

ResponseOutputItem

Enum ResponseOutputItem 

Source
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

§role: String
§status: String
§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
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§encrypted_content: Option<String>

Encrypted reasoning payload for gpt-5 / o-series round-trip. Opaque to SMG; preserved verbatim.

§status: Option<String>
§

FunctionToolCall

Fields

§call_id: String
§name: String
§arguments: String
§output: Option<String>
§status: String
§

McpListTools

Fields

§server_label: String
§error: Option<String>

Spec (openai-responses-api-spec.md §McpListTools L253-255): error?: string. Preserves the failure message when the MCP server could not list tools; symmetric with the matching field on ResponseInputOutputItem::McpListTools so emit↔replay is lossless.

§

McpCall

Fields

§status: String
§approval_request_id: Option<String>
§arguments: String
§name: String
§output: String
§server_label: String
§

McpApprovalRequest

Fields

§server_label: String
§name: String
§arguments: String
§

WebSearchCall

Fields

§results: 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.

§result: String

Base64-encoded image bytes.

§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.

§

Compaction

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.

Fields

§encrypted_content: String
§

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

§call_id: String
§pending_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

§call_id: String
§acknowledged_safety_checks: Vec<ComputerSafetyCheck>
§

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.

§

ShellCallOutput

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.

Fields

§call_id: String
§max_output_length: Option<u64>
§created_by: Option<String>
§

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

Source

pub fn new_message( id: String, role: String, content: Vec<ResponseContentPart>, status: String, ) -> Self

Create a new message output item (no phase).

Source

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.

Source

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.

Source

pub fn new_function_tool_call( id: String, call_id: String, name: String, arguments: String, output: Option<String>, status: String, ) -> Self

Create a new function tool call output item

Trait Implementations§

Source§

impl Clone for ResponseOutputItem

Source§

fn clone(&self) -> ResponseOutputItem

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResponseOutputItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ResponseOutputItem

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for ResponseOutputItem

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for ResponseOutputItem

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more