Skip to main content

CallOptions

Struct CallOptions 

Source
pub struct CallOptions {
Show 17 fields pub prompt: Prompt, pub max_output_tokens: Option<u32>, pub temperature: Option<f64>, pub top_p: Option<f64>, pub top_k: Option<u32>, pub presence_penalty: Option<f64>, pub frequency_penalty: Option<f64>, pub stop_sequences: Option<Vec<String>>, pub seed: Option<u64>, pub response_format: Option<ResponseFormat>, pub tools: Vec<ToolDefinition>, pub tool_choice: Option<ToolChoice>, pub include_raw_chunks: bool, pub reasoning: ReasoningEffort, pub headers: Headers, pub provider_options: ProviderOptions, pub cancellation: CancellationToken,
}
Expand description

Options for a single do_generate or do_stream call.

The core validates and normalizes application settings before building this struct; adapters translate it into a provider request. Options the provider does not support must produce a Warning and be ignored rather than cause an error.

Fields§

§prompt: Prompt

The prompt in specification form.

§max_output_tokens: Option<u32>

Maximum number of output tokens.

§temperature: Option<f64>

Sampling temperature.

§top_p: Option<f64>

Nucleus sampling probability mass.

§top_k: Option<u32>

Top-k sampling.

§presence_penalty: Option<f64>

Presence penalty.

§frequency_penalty: Option<f64>

Frequency penalty.

§stop_sequences: Option<Vec<String>>

Stop sequences.

§seed: Option<u64>

Random seed for deterministic sampling.

§response_format: Option<ResponseFormat>

Output format (text or JSON with an optional schema).

§tools: Vec<ToolDefinition>

Tools available to the model.

§tool_choice: Option<ToolChoice>

Tool choice constraint.

§include_raw_chunks: bool

Whether the stream should include Raw parts with provider chunks.

§reasoning: ReasoningEffort

Requested reasoning effort.

§headers: Headers

Additional request headers.

§provider_options: ProviderOptions

Provider-specific options keyed by provider name.

§cancellation: CancellationToken

Cancellation token; when triggered the adapter aborts the request.

Implementations§

Source§

impl CallOptions

Source

pub fn new(prompt: Prompt) -> Self

Creates call options for prompt with every other field at its default.

Source

pub fn to_recordable(&self) -> CallOptionsRecord

Returns a serializable copy without the cancellation token.

Used for fixtures, snapshots and telemetry. Sensitive header values are masked when the record is serialized.

Source

pub fn provider_options_for(&self, provider_key: &str) -> Option<&JsonObject>

Returns the provider options stored under provider_key, if any.

Trait Implementations§

Source§

impl Clone for CallOptions

Source§

fn clone(&self) -> CallOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CallOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CallOptions

Source§

fn default() -> CallOptions

Returns the “default value” for a type. Read more
Source§

impl From<CallOptionsRecord> for CallOptions

Source§

fn from(record: CallOptionsRecord) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.