pub struct CompletionOptions {
pub model: Option<String>,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub top_p: Option<f32>,
pub frequency_penalty: Option<f32>,
pub presence_penalty: Option<f32>,
pub stop_sequences: Vec<String>,
pub tools: Option<Vec<Tool>>,
pub tool_choice: Option<ToolChoice>,
pub response_format: Option<ResponseFormat>,
}Expand description
Configuration options for chat completions.
Used to configure requests with model selection, sampling parameters, and tool calling settings. This type can be reused across multiple requests.
§Examples
use xai_grpc_client::CompletionOptions;
let options = CompletionOptions::new()
.with_model("grok-2-1212")
.with_temperature(0.7)
.with_max_tokens(500);Fields§
§model: Option<String>Model to use for completion.
temperature: Option<f32>Sampling temperature (0.0-2.0).
max_tokens: Option<u32>Maximum tokens to generate.
top_p: Option<f32>Nucleus sampling probability.
frequency_penalty: Option<f32>§presence_penalty: Option<f32>§stop_sequences: Vec<String>§tools: Option<Vec<Tool>>§tool_choice: Option<ToolChoice>§response_format: Option<ResponseFormat>Implementations§
Source§impl CompletionOptions
impl CompletionOptions
pub fn new() -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_temperature(self, temp: f32) -> Self
pub fn with_max_tokens(self, tokens: u32) -> Self
Trait Implementations§
Source§impl Clone for CompletionOptions
impl Clone for CompletionOptions
Source§fn clone(&self) -> CompletionOptions
fn clone(&self) -> CompletionOptions
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 CompletionOptions
impl Debug for CompletionOptions
Source§impl Default for CompletionOptions
impl Default for CompletionOptions
Source§fn default() -> CompletionOptions
fn default() -> CompletionOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CompletionOptions
impl RefUnwindSafe for CompletionOptions
impl Send for CompletionOptions
impl Sync for CompletionOptions
impl Unpin for CompletionOptions
impl UnwindSafe for CompletionOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request