Module: Mistri::StopReason

Defined in:
lib/mistri/stop_reason.rb

Overview

Why an assistant turn stopped. Providers map their native finish reasons onto this one set, so the loop and the host never read wire spellings.

:stop     - the model finished its answer
:length   - it hit the max-tokens ceiling mid-turn
:tool_use - it paused to call one or more tools
:error    - the provider or runtime failed
:aborted  - the host cancelled the turn
:budget   - a configured ceiling stopped the run

Constant Summary collapse

STOP =
:stop
LENGTH =
:length
TOOL_USE =
:tool_use
ERROR =
:error
ABORTED =
:aborted
BUDGET =
:budget
ALL =
[STOP, LENGTH, TOOL_USE, ERROR, ABORTED, BUDGET].freeze

Class Method Summary collapse

Class Method Details

.valid?(reason) ⇒ Boolean

Returns:

  • (Boolean)


23
# File 'lib/mistri/stop_reason.rb', line 23

def self.valid?(reason) = ALL.include?(reason)