Skip to main content

finish_reason

Function finish_reason 

Source
pub fn finish_reason(response: &ChatResponse) -> Option<&str>
Expand description

The first choice’s raw wire stop condition.

Why: trusty-code’s loop and its tests compare the stop reason as the wire string ("stop", "tool_calls"); the shared type exposes it only as the typed StopReason, and re-deriving the string at each site would risk two spellings drifting apart. What: choices[0].finish_reason.as_deref(), or None. Test: finish_reason_reads_first_choice.