Class: Legion::Extensions::Llm::Canonical::ThinkingConfig
- Inherits:
-
Object
- Object
- Legion::Extensions::Llm::Canonical::ThinkingConfig
- Defined in:
- lib/legion/extensions/llm/canonical/thinking.rb
Overview
Normalized config for thinking across providers. Mirrors lex-llm Thinking::Config.
Constant Summary collapse
- INCLUDES =
Thinking
Instance Attribute Summary collapse
-
#budget ⇒ Object
readonly
Returns the value of attribute budget.
-
#effort ⇒ Object
readonly
Returns the value of attribute effort.
Class Method Summary collapse
-
.build(effort: nil, budget: nil) ⇒ Object
Build from keyword args.
-
.from_hash(source) ⇒ Object
Build from a Hash.
Instance Method Summary collapse
-
#enabled? ⇒ Boolean
Whether thinking is configured.
-
#initialize(effort: nil, budget: nil) ⇒ ThinkingConfig
constructor
A new instance of ThinkingConfig.
-
#to_h ⇒ Object
Serialize to a Hash for AMQP/fleet/wire transport.
Constructor Details
#initialize(effort: nil, budget: nil) ⇒ ThinkingConfig
Returns a new instance of ThinkingConfig.
46 47 48 49 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 46 def initialize(effort: nil, budget: nil) @effort = effort.is_a?(Symbol) ? effort.to_s : effort @budget = budget end |
Instance Attribute Details
#budget ⇒ Object (readonly)
Returns the value of attribute budget.
44 45 46 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 44 def budget @budget end |
#effort ⇒ Object (readonly)
Returns the value of attribute effort.
44 45 46 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 44 def effort @effort end |
Class Method Details
.build(effort: nil, budget: nil) ⇒ Object
Build from keyword args.
52 53 54 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 52 def self.build(effort: nil, budget: nil) new(effort: effort, budget: budget) end |
.from_hash(source) ⇒ Object
Build from a Hash.
57 58 59 60 61 62 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 57 def self.from_hash(source) return nil if source.nil? || source.empty? h = source.transform_keys(&:to_sym) build(effort: h[:effort], budget: h[:budget]) end |
Instance Method Details
#enabled? ⇒ Boolean
Whether thinking is configured.
70 71 72 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 70 def enabled? !effort.nil? || !budget.nil? end |
#to_h ⇒ Object
Serialize to a Hash for AMQP/fleet/wire transport.
65 66 67 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 65 def to_h { effort: effort, budget: budget }.compact end |