Skip to main content

ResponseInputOutputItem

Enum ResponseInputOutputItem 

Source
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: Option<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<McpToolCallError>, 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

§role: String
§status: Option<String>
§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
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 via previous_response_id. Opaque to SMG; preserved verbatim.

§status: Option<String>
§

FunctionToolCall

Fields

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

FunctionCallOutput

Fields

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

McpApprovalRequest

Fields

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

McpApprovalResponse

Fields

§approval_request_id: String
§approve: bool
§reason: Option<String>
§

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.

§result: Option<String>

Base64-encoded image bytes. Omitted on id-only references.

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

Fields

§encrypted_content: String
§

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

§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): output is the ComputerCallOutputContent::ComputerScreenshot payload; acknowledged_safety_checks and status are both optional per spec.

Fields

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

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.

Fields

§call_id: String
§input: String
§name: String
§namespace: Option<String>
§

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

§call_id: String
§environment: Option<ShellCallEnvironment>

Resolved execution environment. Spec constrains this to local or container_reference on the call form (see ShellCallEnvironment docs).

§created_by: Option<String>

Provenance tag mirroring the SDK’s created_by: Optional[str] on ResponseFunctionShellToolCall. Dropped at serialize time when absent so client-authored calls do not carry a null placeholder.

§

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.

Fields

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

Provenance tag mirroring the SDK’s created_by: Optional[str] on ResponseFunctionShellToolCallOutput.

§

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

Fields

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

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.

Fields

§server_label: String
§

SimpleInputMessage

Fields

§role: String
§type: 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

Source

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.

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 input/output item carrying an encrypted reasoning payload. The encrypted_content must be the opaque ciphertext.

Trait Implementations§

Source§

impl Clone for ResponseInputOutputItem

Source§

fn clone(&self) -> ResponseInputOutputItem

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 ResponseInputOutputItem

Source§

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

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

impl<'de> Deserialize<'de> for ResponseInputOutputItem

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 ResponseInputOutputItem

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 ResponseInputOutputItem

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