pub struct StreamOptions {Show 16 fields
pub api_key: Option<String>,
pub headers: IndexMap<String, Option<String>>,
pub reasoning: Option<ThinkingLevel>,
pub max_tokens: Option<u64>,
pub temperature: Option<f64>,
pub session_id: Option<String>,
pub transport: Option<Transport>,
pub websocket_connect_timeout_ms: Option<u64>,
pub timeout_ms: Option<f64>,
pub cache_retention: Option<CacheRetention>,
pub thinking_budgets: ThinkingBudgets,
pub max_retries: u32,
pub max_retry_delay_ms: Option<u64>,
pub cancel: CancellationToken,
pub env: Option<ProviderEnv>,
pub hooks: RequestHooks,
}Expand description
Request options shared by every wire API.
Fields§
§api_key: Option<String>Credential for the provider. Some providers take headers instead.
headers: IndexMap<String, Option<String>>Extra headers. None removes a header the provider would otherwise send.
reasoning: Option<ThinkingLevel>Thinking effort. None and Off disable thinking where the API allows.
max_tokens: Option<u64>Output token limit, or the model’s limit when absent.
temperature: Option<f64>Sampling temperature, where the model and thinking mode allow it.
session_id: Option<String>Stable id for provider-side session affinity and caching.
transport: Option<Transport>Preferred transport for providers that offer more than one. The provider’s default when absent.
websocket_connect_timeout_ms: Option<u64>How long opening a WebSocket may take, in milliseconds. 0 waits forever. The provider’s default when absent.
timeout_ms: Option<f64>pi’s timeoutMs: how long a request may wait, in milliseconds, as
each provider applies it. The provider’s default when absent. A
number, as the settings hold it, so a provider that validates it can
report an invalid one as pi does.
cache_retention: Option<CacheRetention>Prompt cache retention. PI_CACHE_RETENTION=long or short when absent.
thinking_budgets: ThinkingBudgetsToken budgets per level for budget-based thinking.
max_retries: u32Retries for retryable HTTP errors before the first byte. 0 disables them.
max_retry_delay_ms: Option<u64>Largest server-requested retry delay to honor. 0 means no limit.
cancel: CancellationTokenCancels the request, and the stream then ends with an aborted error.
env: Option<ProviderEnv>Provider settings from the credential, such as a Cloudflare account id or an AWS profile, read ahead of the process environment.
hooks: RequestHooksObservers of the request.
Implementations§
Source§impl StreamOptions
impl StreamOptions
Sourcepub fn resolved_cache_retention(&self) -> CacheRetention
pub fn resolved_cache_retention(&self) -> CacheRetention
The cache retention to use: Self::requested_cache_retention, else
short.
Sourcepub fn requested_cache_retention(&self) -> Option<CacheRetention>
pub fn requested_cache_retention(&self) -> Option<CacheRetention>
The option, else long when PI_CACHE_RETENTION=long in env or the
process environment.
Sourcepub fn has_header(&self, name: &str) -> bool
pub fn has_header(&self, name: &str) -> bool
Whether headers sets name (case-insensitive) to a non-blank value.