pub struct ChatOptions {
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub top_p: Option<f32>,
pub stop: Option<Vec<String>>,
pub system: Option<String>,
pub model: Option<String>,
pub cache_strategy: CacheStrategy,
}Expand description
Chat completion options
Fields§
§temperature: Option<f32>Temperature (0.0 - 1.0)
max_tokens: Option<u32>Maximum tokens to generate
top_p: Option<f32>Top-p sampling
stop: Option<Vec<String>>Stop sequences
system: Option<String>System prompt
model: Option<String>Per-request model override.
When Some, providers MUST use this model name instead of their default.
This enables per-session model switching without replacing the provider.
cache_strategy: CacheStrategyPrompt-cache strategy. Ignored by providers without prompt caching.
Implementations§
Source§impl ChatOptions
impl ChatOptions
Sourcepub fn new() -> ChatOptions
pub fn new() -> ChatOptions
Create new chat options with defaults
Sourcepub fn temperature(self, temperature: f32) -> ChatOptions
pub fn temperature(self, temperature: f32) -> ChatOptions
Set temperature
Sourcepub fn max_tokens(self, max_tokens: u32) -> ChatOptions
pub fn max_tokens(self, max_tokens: u32) -> ChatOptions
Set max tokens
Sourcepub fn system<S>(self, system: S) -> ChatOptions
pub fn system<S>(self, system: S) -> ChatOptions
Set system prompt
Sourcepub fn top_p(self, top_p: f32) -> ChatOptions
pub fn top_p(self, top_p: f32) -> ChatOptions
Set top-p sampling
Sourcepub fn model<S>(self, model: S) -> ChatOptions
pub fn model<S>(self, model: S) -> ChatOptions
Override the model for this request.
Sourcepub fn cache_strategy(self, strategy: CacheStrategy) -> ChatOptions
pub fn cache_strategy(self, strategy: CacheStrategy) -> ChatOptions
Set the prompt-cache strategy.
Sourcepub fn deterministic(max_tokens: u32) -> ChatOptions
pub fn deterministic(max_tokens: u32) -> ChatOptions
Deterministic classification/routing (temp=0, few tokens)
Sourcepub fn factual(max_tokens: u32) -> ChatOptions
pub fn factual(max_tokens: u32) -> ChatOptions
Low-temperature factual generation
Sourcepub fn creative(max_tokens: u32) -> ChatOptions
pub fn creative(max_tokens: u32) -> ChatOptions
Creative generation with moderate temperature
Trait Implementations§
Source§impl Clone for ChatOptions
impl Clone for ChatOptions
Source§fn clone(&self) -> ChatOptions
fn clone(&self) -> ChatOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ChatOptions
impl Debug for ChatOptions
Source§impl Default for ChatOptions
impl Default for ChatOptions
Source§fn default() -> ChatOptions
fn default() -> ChatOptions
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ChatOptions
impl<'de> Deserialize<'de> for ChatOptions
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChatOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChatOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ChatOptions
impl Serialize for ChatOptions
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
Auto Trait Implementations§
impl Freeze for ChatOptions
impl RefUnwindSafe for ChatOptions
impl Send for ChatOptions
impl Sync for ChatOptions
impl Unpin for ChatOptions
impl UnsafeUnpin for ChatOptions
impl UnwindSafe for ChatOptions
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> 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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.