pub struct ResponseRequest { /* private fields */ }Expand description
Request body for POST /v1/responses.
Implementations§
Source§impl ResponseRequest
impl ResponseRequest
Sourcepub fn new(model: impl Into<String>, input: impl Into<ResponseInput>) -> Self
pub fn new(model: impl Into<String>, input: impl Into<ResponseInput>) -> Self
Creates a request. input accepts plain text or a list of InputItems.
Sourcepub fn instructions(self, instructions: impl Into<String>) -> Self
pub fn instructions(self, instructions: impl Into<String>) -> Self
System-level guidance (replaces the system message of Chat Completions).
Sourcepub fn max_output_tokens(self, max_output_tokens: u32) -> Self
pub fn max_output_tokens(self, max_output_tokens: u32) -> Self
Upper bound on generated tokens, including invisible reasoning tokens.
Sourcepub fn temperature(self, temperature: f32) -> Self
pub fn temperature(self, temperature: f32) -> Self
Sampling temperature (0.0-2.0). Not supported by reasoning models.
Sourcepub fn top_p(self, top_p: f32) -> Self
pub fn top_p(self, top_p: f32) -> Self
Nucleus sampling mass (0.0-1.0). Alternative to temperature.
Sourcepub fn reasoning(self, reasoning: ReasoningConfig) -> Self
pub fn reasoning(self, reasoning: ReasoningConfig) -> Self
Full reasoning configuration; see ResponseRequest::reasoning_effort
for the common case.
Sourcepub fn reasoning_effort(self, effort: impl Into<String>) -> Self
pub fn reasoning_effort(self, effort: impl Into<String>) -> Self
Shorthand for setting reasoning.effort.
Known values: "none", "minimal", "low", "medium", "high".
Sourcepub fn text(self, text: TextConfig) -> Self
pub fn text(self, text: TextConfig) -> Self
Full text output configuration; see ResponseRequest::json_schema
and ResponseRequest::verbosity for the common cases.
Sourcepub fn json_schema(self, name: impl Into<String>, schema: Value) -> Self
pub fn json_schema(self, name: impl Into<String>, schema: Value) -> Self
Shorthand for Structured Outputs: sets text.format to a strict JSON schema.
Sourcepub fn verbosity(self, verbosity: impl Into<String>) -> Self
pub fn verbosity(self, verbosity: impl Into<String>) -> Self
Shorthand for setting text.verbosity. Known values: "low", "medium", "high".
Sourcepub fn tools(self, tools: Vec<Tool>) -> Self
pub fn tools(self, tools: Vec<Tool>) -> Self
Tools the model may call: custom functions and OpenAI built-ins.
Sourcepub fn tool_choice(self, tool_choice: Value) -> Self
pub fn tool_choice(self, tool_choice: Value) -> Self
Constrains tool selection: "none", "auto", "required", or a
specific-tool object (passed through as raw JSON).
Sourcepub fn parallel_tool_calls(self, parallel_tool_calls: bool) -> Self
pub fn parallel_tool_calls(self, parallel_tool_calls: bool) -> Self
Whether the model may issue several tool calls in one turn.
Sourcepub fn store(self, store: bool) -> Self
pub fn store(self, store: bool) -> Self
Whether the response is persisted server-side (API default: true).
Sourcepub fn previous_response_id(
self,
previous_response_id: impl Into<String>,
) -> Self
pub fn previous_response_id( self, previous_response_id: impl Into<String>, ) -> Self
Chains onto a stored response to continue a conversation server-side.
Sourcepub fn metadata(self, metadata: HashMap<String, String>) -> Self
pub fn metadata(self, metadata: HashMap<String, String>) -> Self
Up to 16 key-value pairs attached to the stored response.
Sourcepub fn truncation(self, truncation: impl Into<String>) -> Self
pub fn truncation(self, truncation: impl Into<String>) -> Self
Context overflow handling: "auto" or "disabled".
Sourcepub fn service_tier(self, service_tier: impl Into<String>) -> Self
pub fn service_tier(self, service_tier: impl Into<String>) -> Self
Processing tier: "auto", "default", "flex", "scale", or "priority".
Sourcepub fn background(self, background: bool) -> Self
pub fn background(self, background: bool) -> Self
Runs the response in the background; poll with Responses::retrieve.
Trait Implementations§
Source§impl Clone for ResponseRequest
impl Clone for ResponseRequest
Source§fn clone(&self) -> ResponseRequest
fn clone(&self) -> ResponseRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more