pub struct Response {Show 26 fields
pub id: String,
pub created_at: u64,
pub error: Option<ResponseError>,
pub incomplete_details: Option<IncompleteDetails>,
pub instructions: Option<String>,
pub metadata: Option<HashMap<String, String>>,
pub model: String,
pub object: ResponseObject,
pub output: Vec<ResponseOutputItem>,
pub parallel_tool_calls: Option<bool>,
pub previous_response_id: Option<String>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub store: Option<bool>,
pub status: Option<ResponseStatus>,
pub usage: Option<ResponseUsage>,
pub background: Option<bool>,
pub completed_at: Option<u64>,
pub max_output_tokens: Option<u32>,
pub max_tool_calls: Option<u32>,
pub top_logprobs: Option<u32>,
pub truncation: Option<Truncation>,
pub service_tier: Option<ServiceTier>,
pub user: Option<String>,
pub safety_identifier: Option<String>,
pub prompt_cache_key: Option<String>,
}Expand description
The response object returned by the Responses API (non-streaming create, the final streaming events, and retrieve).
Fields§
§id: StringUnique identifier for this response.
created_at: u64Unix timestamp (in seconds) of when this response was created.
error: Option<ResponseError>An error object returned when the model fails to generate a response.
incomplete_details: Option<IncompleteDetails>Details about why the response is incomplete, if it is.
instructions: Option<String>The system (or developer) message inserted into the model’s context, echoed back when one was supplied.
metadata: Option<HashMap<String, String>>Set of key-value pairs attached to the response, echoed back when
metadata was supplied in the request.
model: StringThe model that generated the response.
object: ResponseObjectThe object type, which is always response.
output: Vec<ResponseOutputItem>The output items generated by the model (messages, reasoning, tool calls, …).
parallel_tool_calls: Option<bool>Whether the model ran tool calls in parallel.
previous_response_id: Option<String>The unique ID of the previous response this one builds upon, when
previous_response_id was used.
temperature: Option<f32>The sampling temperature used.
top_p: Option<f32>The nucleus sampling threshold used.
store: Option<bool>Whether the response is stored for later retrieval.
status: Option<ResponseStatus>The status of the response generation.
usage: Option<ResponseUsage>Usage statistics for the request.
background: Option<bool>Whether the response ran in the background (echo of the request parameter).
completed_at: Option<u64>Unix timestamp (in seconds) of when this response completed. Only
present when the status is completed.
max_output_tokens: Option<u32>Upper bound for the number of tokens that could be generated (echo of the request parameter).
max_tool_calls: Option<u32>Maximum number of built-in tool calls processed in this response (echo of the request parameter).
top_logprobs: Option<u32>Number of most likely tokens returned at each output position (echo of the request parameter).
truncation: Option<Truncation>The truncation strategy used for the response (echo of the request parameter).
service_tier: Option<ServiceTier>The service tier actually used to serve the request. May differ from the value requested.
user: Option<String>End-user identifier (echo of the request parameter).
safety_identifier: Option<String>Stable identifier used for usage-policy violation detection (echo of the request parameter).
prompt_cache_key: Option<String>Prompt cache key (echo of the request parameter).
Implementations§
Source§impl Response
impl Response
Sourcepub fn is_completed(&self) -> bool
pub fn is_completed(&self) -> bool
Whether this response completed successfully.
Sourcepub fn output_text(&self) -> String
pub fn output_text(&self) -> String
Aggregates all output_text content of the output message items
into a single string, like the output_text property of the official
SDKs. Returns an empty string when there is no text output.
Sourcepub fn reasoning_text(&self) -> String
pub fn reasoning_text(&self) -> String
Aggregates the plain-text reasoning content of the output reasoning
items into a single string. Returns an empty string when there is no
plaintext reasoning content (e.g. when the provider only returns
reasoning summaries or encrypted content).