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.
55 56 57 58 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 55 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.
53 54 55 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 53 def budget @budget end |
#effort ⇒ Object (readonly)
Returns the value of attribute effort.
53 54 55 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 53 def effort @effort end |
Class Method Details
.build(effort: nil, budget: nil) ⇒ Object
Build from keyword args.
61 62 63 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 61 def self.build(effort: nil, budget: nil) new(effort: effort, budget: budget) end |
.from_hash(source) ⇒ Object
Build from a Hash.
66 67 68 69 70 71 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 66 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.
79 80 81 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 79 def enabled? !effort.nil? || !budget.nil? end |
#to_h ⇒ Object
Serialize to a Hash for AMQP/fleet/wire transport.
74 75 76 |
# File 'lib/legion/extensions/llm/canonical/thinking.rb', line 74 def to_h { effort: effort, budget: budget }.compact end |