pub struct ResponsesArguments {
pub model: String,
pub input: Vec<ResponsesMessage>,
pub tools: Option<Vec<GrokTool>>,
pub temperature: Option<f32>,
pub max_output_tokens: Option<u32>,
}Expand description
Request arguments for xAI’s Responses API endpoint (/v1/responses).
This API provides agentic tool calling where the model autonomously
explores, searches, and executes code. Unlike the Chat Completions API,
the Responses API uses input instead of messages and tools instead
of server_tools.
§Example
use openai_rust2::chat::{ResponsesArguments, ResponsesMessage, GrokTool};
let args = ResponsesArguments::new(
"grok-4-1-fast-reasoning",
vec![ResponsesMessage {
role: "user".to_string(),
content: "What is the current price of Bitcoin?".to_string(),
}],
).with_tools(vec![GrokTool::web_search()]);Fields§
§model: String§input: Vec<ResponsesMessage>§tools: Option<Vec<GrokTool>>§temperature: Option<f32>§max_output_tokens: Option<u32>Implementations§
Source§impl ResponsesArguments
impl ResponsesArguments
Sourcepub fn new(model: impl AsRef<str>, input: Vec<ResponsesMessage>) -> Self
pub fn new(model: impl AsRef<str>, input: Vec<ResponsesMessage>) -> Self
Create new ResponsesArguments for the xAI Responses API.
Sourcepub fn with_tools(self, tools: Vec<GrokTool>) -> Self
pub fn with_tools(self, tools: Vec<GrokTool>) -> Self
Add tools for agentic capabilities.
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature for response generation.
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 ResponsesArguments
impl Clone for ResponsesArguments
Source§fn clone(&self) -> ResponsesArguments
fn clone(&self) -> ResponsesArguments
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 ResponsesArguments
impl Debug for ResponsesArguments
Auto Trait Implementations§
impl Freeze for ResponsesArguments
impl RefUnwindSafe for ResponsesArguments
impl Send for ResponsesArguments
impl Sync for ResponsesArguments
impl Unpin for ResponsesArguments
impl UnwindSafe for ResponsesArguments
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