pub struct CompletionRequest {
pub input: OneOrMany<InputItem>,
pub model: String,
pub instructions: Option<String>,
pub max_output_tokens: Option<u64>,
pub stream: Option<bool>,
pub temperature: Option<f64>,
pub tools: Vec<ResponsesToolDefinition>,
pub additional_parameters: AdditionalParameters,
/* private fields */
}Expand description
The completion request type for OpenAI’s Response API: https://platform.openai.com/docs/api-reference/responses/create
Intended to be derived from crate::completion::request::CompletionRequest.
Fields§
§input: OneOrMany<InputItem>Message inputs
model: StringThe model name
instructions: Option<String>Instructions (also referred to as preamble, although in other APIs this would be the “system prompt”)
max_output_tokens: Option<u64>The maximum number of output tokens.
stream: Option<bool>Toggle to true for streaming responses.
temperature: Option<f64>The temperature. Set higher (up to a max of 1.0) for more creative responses.
tools: Vec<ResponsesToolDefinition>The tools you want to use. This supports both function tools and hosted tools
such as web_search, file_search, and computer_use.
additional_parameters: AdditionalParametersAdditional parameters
Implementations§
Source§impl CompletionRequest
impl CompletionRequest
pub fn with_structured_outputs<S>(self, schema_name: S, schema: Value) -> Self
pub fn with_reasoning(self, reasoning: Reasoning) -> Self
Sourcepub fn with_tool(self, tool: impl Into<ResponsesToolDefinition>) -> Self
pub fn with_tool(self, tool: impl Into<ResponsesToolDefinition>) -> Self
Adds a provider-native hosted tool (e.g. web_search, file_search, computer_use)
to the request. These tools are executed by OpenAI’s infrastructure, not by Rig’s
agent loop.
Sourcepub fn with_tools<I, Tool>(self, tools: I) -> Self
pub fn with_tools<I, Tool>(self, tools: I) -> Self
Adds multiple provider-native hosted tools to the request. These tools are executed by OpenAI’s infrastructure, not by Rig’s agent loop.
Trait Implementations§
Source§impl Clone for CompletionRequest
impl Clone for CompletionRequest
Source§fn clone(&self) -> CompletionRequest
fn clone(&self) -> CompletionRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompletionRequest
impl Debug for CompletionRequest
Source§impl<'de> Deserialize<'de> for CompletionRequest
impl<'de> Deserialize<'de> for CompletionRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for CompletionRequest
impl Serialize for CompletionRequest
Source§impl TryFrom<(String, CompletionRequest)> for CompletionRequest
Attempt to try and create a NewCompletionRequest from a model name and crate::completion::CompletionRequest
impl TryFrom<(String, CompletionRequest)> for CompletionRequest
Attempt to try and create a NewCompletionRequest from a model name and crate::completion::CompletionRequest
Auto Trait Implementations§
impl Freeze for CompletionRequest
impl RefUnwindSafe for CompletionRequest
impl Send for CompletionRequest
impl Sync for CompletionRequest
impl Unpin for CompletionRequest
impl UnsafeUnpin for CompletionRequest
impl UnwindSafe for CompletionRequest
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
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more