anthropic.internal._stop_reason

(internal) One wire stop_reason string -> the canonical stop reason.

Reference version

Signature

function anthropic.internal._stop_reason(s: string) -> ai.content.StopReason

(internal) One wire stop_reason string -> the canonical stop reason.

end_turn/stop_sequence are the only reasons that mean "the model said everything it meant to say". pause_turn, model_context_window_exceeded and anything Anthropic ships next are TRUNCATIONS, so they map to MaxTokens (the runner's "incomplete answer" outcome) rather than silently reporting a truncated candidate as a successful completion.

Source:<builtin>/anthropic/ns_internal/messages.bamlbytes 3223832619