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. Currently this is limited to functions, but will be expanded on in future.
additional_parameters: AdditionalParametersAdditional parameters
Implementations§
Source§impl CompletionRequest
impl CompletionRequest
pub fn with_structured_outputs<S>( self, schema_name: S, schema: Value, ) -> CompletionRequest
pub fn with_reasoning(self, reasoning: Reasoning) -> CompletionRequest
Trait Implementations§
Source§impl Clone for CompletionRequest
impl Clone for CompletionRequest
Source§fn clone(&self) -> CompletionRequest
fn clone(&self) -> CompletionRequest
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 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<CompletionRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CompletionRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for CompletionRequest
impl Serialize for CompletionRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
Source§type Error = CompletionError
type Error = CompletionError
The type returned in the event of a conversion error.
Source§fn try_from(
_: (String, CompletionRequest),
) -> Result<CompletionRequest, <CompletionRequest as TryFrom<(String, CompletionRequest)>>::Error>
fn try_from( _: (String, CompletionRequest), ) -> Result<CompletionRequest, <CompletionRequest as TryFrom<(String, CompletionRequest)>>::Error>
Performs the conversion.
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
Mutably borrows from an owned value. Read more