Module: Raif::Concerns::LlmOutputLimits

Extended by:
ActiveSupport::Concern
Included in:
Task
Defined in:
app/models/raif/concerns/llm_output_limits.rb

Overview

Per-class limits on what a task's model completion may generate. All three are opt-in; a class that declares none sends the model's defaults and completes a truncated response as before.

class MyTask < Raif::Task
llm_max_completion_tokens 8_000
llm_stop_sequences ["END_OF_ANSWER"]
llm_fail_on_truncation true
end

Stop sequences reach only providers whose API accepts them (Anthropic and Google); other providers ignore them. A completion that ends on a stop sequence completes normally. With llm_fail_on_truncation, a completion that ends at the output cap fails the task instead of completing it with a partial response.