pub struct CallOptions {Show 23 fields
pub prompt: LanguageModelPrompt,
pub max_output_tokens: Option<u32>,
pub temperature: Option<f64>,
pub stop_sequences: Option<Vec<String>>,
pub top_p: Option<f64>,
pub top_k: Option<f64>,
pub presence_penalty: Option<f64>,
pub frequency_penalty: Option<f64>,
pub response_format: Option<ResponseFormat>,
pub seed: Option<u64>,
pub tools: Option<Vec<Tool>>,
pub tool_choice: ToolChoice,
pub headers: Option<HashMap<String, String>>,
pub provider_options: Option<HashMap<String, Value>>,
pub reasoning: Option<ReasoningEffort>,
pub body_overrides: Option<Value>,
pub max_retries: Option<u32>,
pub timeout: Option<TimeoutConfiguration>,
pub session_id: Option<String>,
pub abort_signal: Option<AbortSignal>,
pub call_id: Option<String>,
pub recording_context: Option<RecordingContext>,
pub include_raw_chunks: Option<bool>,
}Expand description
Options passed to LanguageModel::do_generate / do_stream.
This is the provider-facing options struct. Users interact with
GenerateTextOptions (user-facing) which is converted to CallOptions
by the generate_text / stream_text functions.
Fields§
§prompt: LanguageModelPromptThe standardized prompt (message array). Required.
max_output_tokens: Option<u32>Maximum tokens to generate.
temperature: Option<f64>Sampling temperature.
stop_sequences: Option<Vec<String>>Stop sequences.
top_p: Option<f64>Nucleus sampling top_p.
top_k: Option<f64>Top-k sampling.
presence_penalty: Option<f64>Presence penalty.
frequency_penalty: Option<f64>Frequency penalty.
response_format: Option<ResponseFormat>Response format (text or JSON).
seed: Option<u64>Seed for reproducibility.
tools: Option<Vec<Tool>>Tools available to the model (function tools and/or provider-defined tools).
tool_choice: ToolChoiceHow the model should choose tools.
headers: Option<HashMap<String, String>>Extra HTTP headers.
provider_options: Option<HashMap<String, Value>>Provider-specific options (keyed by provider name).
reasoning: Option<ReasoningEffort>Top-level reasoning effort. Maps to OpenAI reasoning_effort and
Anthropic thinking config.
body_overrides: Option<Value>Per-call request body overrides. Deep-merged into the provider-built
request body (after any built-in vendor override) before sending.
null values delete the corresponding key. See RFC-0017.
max_retries: Option<u32>Per-call retry count override. None uses the provider’s configured
Core operation retry. Some(0) disables retries.
timeout: Option<TimeoutConfiguration>Per-call timeout configuration (total / first-chunk / chunk idle).
None = no timeouts (provider defaults still apply at the HTTP layer).
session_id: Option<String>Session identifier, for grouping consecutive calls into a session
(observability, see RFC-0024). Explicit values take precedence; when
None and the optional session inferer is enabled, one may be inferred.
Orthogonal to RFC-0019 session-affinity headers: this field is for
local grouping, while session headers in headers are for upstream
routing — both may share an id value but travel different paths.
abort_signal: Option<AbortSignal>Abort signal for cancelling the call.
Runtime handle — never crosses the JSON boundary (bindings that only
pass JSON cannot set it; Node bridges a JS AbortSignal natively).
call_id: Option<String>RFC-0023 recording correlation id (internal; never serialized).
recording_context: Option<RecordingContext>RFC-0023 recording context (R7 快照绑定;internal;never serialized)。
层 A 入口构造一次,provider 复制到 HttpRequest。None = 不录制。
include_raw_chunks: Option<bool>Emit raw provider stream chunks as StreamPart::Raw (debugging aid).
When Some(true), streaming providers yield one Raw part per JSON
SSE event, carrying the parsed JSON payload of the event, emitted
before the parsed parts. Excludes the [DONE] sentinel; unparsable
chunks emit only Error. null/Some(false) = off.
Currently honored by the OpenAI-compatible family (openai / azure /
openai-compatible registry providers); other provider families ignore
it for now (RFC-0016 M2).
Implementations§
Source§impl CallOptions
impl CallOptions
Sourcepub fn for_step(&self, step: impl Into<String>) -> Self
pub fn for_step(&self, step: impl Into<String>) -> Self
Clone these options for one composite child step (Router child, MoA
reference or aggregator): the recording context, when present, is
replaced by a child context labeled step, so the child’s exchanges
and retry attempts are recorded as their own step instead of blending
into the parent operation’s.
Sourcepub fn new(prompt: LanguageModelPrompt) -> Self
pub fn new(prompt: LanguageModelPrompt) -> Self
Create a CallOptions with the given prompt and all other fields set
to their defaults (None / ToolChoice::Auto).
This is the recommended construction baseline in tests — combined with
struct-update syntax (CallOptions { tools: Some(..), ..CallOptions::new(prompt) })
it avoids spelling out every None field, so adding a new optional
field to CallOptions no longer requires batch-editing every test.
Trait Implementations§
Source§impl Clone for CallOptions
impl Clone for CallOptions
Source§impl Debug for CallOptions
impl Debug for CallOptions
Source§impl Default for CallOptions
impl Default for CallOptions
Source§impl<'de> Deserialize<'de> for CallOptions
impl<'de> Deserialize<'de> for CallOptions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for CallOptions
impl Serialize for CallOptions
Source§impl TS for CallOptions
impl TS for CallOptions
Source§type WithoutGenerics = CallOptions
type WithoutGenerics = CallOptions
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = CallOptions
type OptionInnerType = CallOptions
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
Source§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export. Read more