Skip to main content

model_refusal_from_error

Function model_refusal_from_error 

pub fn model_refusal_from_error(error: &Error) -> Option<&ModelRefusalError>
Expand description

Return the typed refusal that terminated a provider result, if any.

Reliable keeps the final cause underneath its rejected-usage and terminal failure envelopes, and a streamed refusal arrives inside StreamError, so the leaf type is found by walking the chain rather than by an outer downcast. A later non-refusal failure replaces the refusal as the final cause and therefore yields None.