Skip to main content

refusal_reason

Function refusal_reason 

Source
pub fn refusal_reason(response: &LLMResponse) -> String
Expand description

User-facing explanation for a provider refusal.

Anthropic reports the refusal category and explanation in a stop_details reasoning detail, and reports server-side fallback activity as a fallback reasoning detail, fallback_message usage iterations, or a recommended_model when the fallback could not run. Other providers only report the finish reason, sometimes with a refusal message in the content; that content (trimmed and bounded) is the explanation when no stop_details explanation exists.