pub struct StreamOptions {
pub temperature: Option<f64>,
pub max_tokens: Option<usize>,
pub api_key: Option<String>,
pub cache_retention: Option<CacheRetention>,
pub session_id: Option<String>,
pub headers: HashMap<String, String>,
pub thinking_level: Option<ThinkingLevel>,
pub thinking_budgets: Option<ThinkingBudgets>,
pub tool_choice: Option<ToolChoice>,
pub provider_options: Option<ProviderOptions>,
}Expand description
Fields§
§temperature: Option<f64>Sampling temperature (0.0 to 2.0)
max_tokens: Option<usize>Maximum tokens to generate
api_key: Option<String>API key (overrides environment variable) This field is excluded from serialization and Debug output to prevent leakage.
cache_retention: Option<CacheRetention>Cache retention preference
session_id: Option<String>Session ID for providers that support session-based caching
headers: HashMap<String, String>Custom HTTP headers to include
thinking_level: Option<ThinkingLevel>Thinking/reasoning level
thinking_budgets: Option<ThinkingBudgets>Custom token budgets for thinking levels
tool_choice: Option<ToolChoice>Forces the next assistant turn’s tool choice. None/Auto = no
change from today’s behavior. See crate::tools::ToolChoice.
provider_options: Option<ProviderOptions>Per-provider options for fine-grained control.
Each provider reads only its own section. For example, the Anthropic
provider reads provider_options.anthropic, OpenAI reads
provider_options.openai. This allows a single request to carry
options for multiple providers without conflicts.
Implementations§
Source§impl StreamOptions
impl StreamOptions
Sourcepub fn new() -> StreamOptions
pub fn new() -> StreamOptions
Create new stream options
Sourcepub fn temperature(self, temp: f64) -> StreamOptions
pub fn temperature(self, temp: f64) -> StreamOptions
Set temperature
Sourcepub fn max_tokens(self, tokens: usize) -> StreamOptions
pub fn max_tokens(self, tokens: usize) -> StreamOptions
Set max tokens
Sourcepub fn api_key(self, key: impl Into<String>) -> StreamOptions
pub fn api_key(self, key: impl Into<String>) -> StreamOptions
Set API key
Sourcepub fn cache_retention(self, retention: CacheRetention) -> StreamOptions
pub fn cache_retention(self, retention: CacheRetention) -> StreamOptions
Set cache retention
Sourcepub fn session_id(self, id: impl Into<String>) -> StreamOptions
pub fn session_id(self, id: impl Into<String>) -> StreamOptions
Set session ID
Sourcepub fn thinking_level(self, level: ThinkingLevel) -> StreamOptions
pub fn thinking_level(self, level: ThinkingLevel) -> StreamOptions
Set thinking level
Trait Implementations§
Source§impl Clone for StreamOptions
impl Clone for StreamOptions
Source§fn clone(&self) -> StreamOptions
fn clone(&self) -> StreamOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamOptions
impl Debug for StreamOptions
Source§impl Default for StreamOptions
impl Default for StreamOptions
Source§fn default() -> StreamOptions
fn default() -> StreamOptions
Source§impl<'de> Deserialize<'de> for StreamOptions
impl<'de> Deserialize<'de> for StreamOptions
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StreamOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StreamOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for StreamOptions
impl Serialize for StreamOptions
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,
Auto Trait Implementations§
impl Freeze for StreamOptions
impl RefUnwindSafe for StreamOptions
impl Send for StreamOptions
impl Sync for StreamOptions
impl Unpin for StreamOptions
impl UnsafeUnpin for StreamOptions
impl UnwindSafe for StreamOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.