Struct ModelRefusalError
pub struct ModelRefusalError {
pub requested_model: String,
pub category: Option<String>,
pub usage: Option<Box<TokenUsage>>,
pub attempted_candidate: Option<String>,
pub attempted_candidate_index: Option<usize>,
}Expand description
A provider safety refusal that completed at the transport layer but cannot be accepted as an assistant response.
The optional usage belongs to the refusing attempt. It is carried on the
typed cause so reliability and turn accounting can bill that work without
treating it as accepted-response context usage. category is diagnostic
metadata only and must not be rendered to users.
Fields§
§requested_model: StringModel requested on the refusing attempt.
category: Option<String>Refusal category token, when the provider supplied one.
usage: Option<Box<TokenUsage>>Normalized usage billed by the refusing attempt.
attempted_candidate: Option<String>Exact reliability candidate that emitted a streamed refusal.
Leaf providers leave this unset. Composite providers fill it while forwarding a stream so a non-streaming recovery can skip exactly the already-billed candidate.
attempted_candidate_index: Option<usize>Position of that candidate in the active reliability domain.
This disambiguates same-profile fallback models, which intentionally share one configured candidate/cooldown identity.
Trait Implementations§
Source§impl Clone for ModelRefusalError
impl Clone for ModelRefusalError
Source§fn clone(&self) -> ModelRefusalError
fn clone(&self) -> ModelRefusalError
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelRefusalError
impl Debug for ModelRefusalError
Source§impl Display for ModelRefusalError
impl Display for ModelRefusalError
Source§impl Error for ModelRefusalError
impl Error for ModelRefusalError
1.30.0 · §fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · §fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()