Module: Legion::Extensions::Llm::Bedrock::RenderDefaults

Defined in:
lib/legion/extensions/llm/bedrock/render_defaults.rb

Overview

One owner for the render-side max_tokens decision (B18): the Canonical::Params member is authoritative; a missing value defaults once, identically, at this owner — invoke_model requires the field on the wire (4096), Converse omits it (the API default applies). The fork by model object type (a Model::Info with max_output_tokens metadata winning over a String model id) is deleted: the same canonical request renders the same wire regardless of the model's object wrapping (R13).

Constant Summary collapse

DEFAULT_MAX_TOKENS =
4096

Class Method Summary collapse

Class Method Details

.max_tokens(params, target:) ⇒ Integer?

Parameters:

  • params (Canonical::Params, nil)
  • target (:converse, :invoke_model)

Returns:

  • (Integer, nil)


23
24
25
# File 'lib/legion/extensions/llm/bedrock/render_defaults.rb', line 23

def max_tokens(params, target:)
  params&.max_tokens || (target == :invoke_model ? DEFAULT_MAX_TOKENS : nil)
end