pub struct OpenAIResponsesArguments {
pub model: String,
pub input: Vec<ResponsesMessage>,
pub tools: Option<Vec<OpenAITool>>,
pub temperature: Option<f32>,
pub max_output_tokens: Option<u32>,
}Expand description
Request arguments for OpenAI’s Responses API endpoint (/v1/responses).
This API provides agentic tool calling where the model autonomously
uses web_search, file_search, or code_interpreter tools. Unlike the Chat
Completions API, the Responses API uses input instead of messages and
tools instead of function definitions.
§Example
use openai_rust2::chat::{OpenAIResponsesArguments, OpenAITool};
let args = OpenAIResponsesArguments::new(
"gpt-5",
vec![{
"role": "user",
"content": "What's the latest news about AI?"
}],
).with_tools(vec![OpenAITool::web_search()]);Fields§
§model: String§input: Vec<ResponsesMessage>§tools: Option<Vec<OpenAITool>>§temperature: Option<f32>§max_output_tokens: Option<u32>Implementations§
Source§impl OpenAIResponsesArguments
impl OpenAIResponsesArguments
Sourcepub fn new(model: impl AsRef<str>, input: Vec<ResponsesMessage>) -> Self
pub fn new(model: impl AsRef<str>, input: Vec<ResponsesMessage>) -> Self
Create new OpenAIResponsesArguments for the OpenAI Responses API.
Sourcepub fn with_tools(self, tools: Vec<OpenAITool>) -> Self
pub fn with_tools(self, tools: Vec<OpenAITool>) -> Self
Add tools for agentic capabilities (web_search, file_search, code_interpreter).
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature for response generation (0.0 to 2.0).
Sourcepub fn with_max_output_tokens(self, max_tokens: u32) -> Self
pub fn with_max_output_tokens(self, max_tokens: u32) -> Self
Set the maximum output tokens.
Trait Implementations§
Source§impl Clone for OpenAIResponsesArguments
impl Clone for OpenAIResponsesArguments
Source§fn clone(&self) -> OpenAIResponsesArguments
fn clone(&self) -> OpenAIResponsesArguments
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenAIResponsesArguments
impl Debug for OpenAIResponsesArguments
Auto Trait Implementations§
impl Freeze for OpenAIResponsesArguments
impl RefUnwindSafe for OpenAIResponsesArguments
impl Send for OpenAIResponsesArguments
impl Sync for OpenAIResponsesArguments
impl Unpin for OpenAIResponsesArguments
impl UnwindSafe for OpenAIResponsesArguments
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more