pub struct CreateResponseRequest {Show 20 fields
pub model: String,
pub input: Input,
pub instructions: Option<String>,
pub max_output_tokens: Option<u64>,
pub max_tool_calls: Option<u64>,
pub metadata: Option<HashMap<String, String>>,
pub previous_response_id: Option<String>,
pub reasoning: Option<Reasoning>,
pub store: Option<bool>,
pub stream: Option<bool>,
pub temperature: Option<f64>,
pub text: Option<ResponseTextConfig>,
pub tool_choice: Option<ToolChoice>,
pub tools: Option<Vec<Tool>>,
pub top_p: Option<f64>,
pub truncation: Option<Truncation>,
pub include: Option<Vec<ResponseIncludable>>,
pub background: Option<bool>,
pub parallel_tool_calls: Option<bool>,
pub extra: HashMap<String, Value>,
}Expand description
Request body for POST /responses.
Fields§
§model: String§input: InputOmitted from the request body when empty (e.g. a continuation request
driven purely by previous_response_id) rather than sent as null.
instructions: Option<String>§max_output_tokens: Option<u64>§max_tool_calls: Option<u64>§metadata: Option<HashMap<String, String>>§previous_response_id: Option<String>§reasoning: Option<Reasoning>§store: Option<bool>§stream: Option<bool>§temperature: Option<f64>§text: Option<ResponseTextConfig>§tool_choice: Option<ToolChoice>§tools: Option<Vec<Tool>>§top_p: Option<f64>§truncation: Option<Truncation>§include: Option<Vec<ResponseIncludable>>§background: Option<bool>§parallel_tool_calls: Option<bool>§extra: HashMap<String, Value>Escape hatch: additional request parameters flattened into the JSON body, for provider-specific or newly-added params not yet typed.
Implementations§
Source§impl CreateResponseRequest
impl CreateResponseRequest
pub fn new(model: impl Into<String>, input: impl Into<Input>) -> Self
pub fn instructions(self, instructions: impl Into<String>) -> Self
pub fn max_output_tokens(self, max: u64) -> Self
pub fn max_tool_calls(self, max: u64) -> Self
pub fn metadata(self, metadata: HashMap<String, String>) -> Self
Sourcepub fn previous_response_id(self, id: impl Into<String>) -> Self
pub fn previous_response_id(self, id: impl Into<String>) -> Self
Chain this request onto a prior response, for stateful multi-turn tool-calling loops.
pub fn reasoning(self, reasoning: Reasoning) -> Self
pub fn store(self, store: bool) -> Self
pub fn temperature(self, temperature: f64) -> Self
pub fn text(self, text: ResponseTextConfig) -> Self
pub fn tool_choice(self, tool_choice: ToolChoice) -> Self
pub fn tools(self, tools: Vec<Tool>) -> Self
pub fn top_p(self, top_p: f64) -> Self
pub fn truncation(self, truncation: Truncation) -> Self
pub fn include(self, include: Vec<ResponseIncludable>) -> Self
Sourcepub fn background(self, background: bool) -> Self
pub fn background(self, background: bool) -> Self
Run this response asynchronously; poll or stream-resume via
retrieve/retrieve_stream.
pub fn parallel_tool_calls(self, parallel: bool) -> Self
Sourcepub fn param(self, key: impl Into<String>, value: impl Into<Value>) -> Self
pub fn param(self, key: impl Into<String>, value: impl Into<Value>) -> Self
Set an arbitrary extra parameter on the request body (escape hatch
for provider-specific or newly-added params). Do not use this to set
stream: extra is flattened after the typed fields, so a
param("stream", ...) value serializes last and silently overrides
whatever create/create_stream set on the typed stream field.
Trait Implementations§
Source§impl Clone for CreateResponseRequest
impl Clone for CreateResponseRequest
Source§fn clone(&self) -> CreateResponseRequest
fn clone(&self) -> CreateResponseRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more