Class: RubyLLM::Thinking::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/thinking.rb

Overview

:nodoc: all

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(effort: nil, budget: nil, display: nil, enabled: nil, intent: nil) ⇒ Config

Returns a new instance of Config.



120
121
122
123
124
125
126
# File 'lib/ruby_llm/thinking.rb', line 120

def initialize(effort: nil, budget: nil, display: nil, enabled: nil, intent: nil)
  @effort = effort&.to_sym
  @budget = budget
  @display = display&.to_sym
  @enabled = enabled
  @intent = intent
end

Instance Attribute Details

#budgetObject (readonly)

Returns the value of attribute budget.



110
111
112
# File 'lib/ruby_llm/thinking.rb', line 110

def budget
  @budget
end

#displayObject (readonly)

Returns the value of attribute display.



110
111
112
# File 'lib/ruby_llm/thinking.rb', line 110

def display
  @display
end

#effortObject (readonly)

Returns the value of attribute effort.



110
111
112
# File 'lib/ruby_llm/thinking.rb', line 110

def effort
  @effort
end

#enabledObject (readonly)

Returns the value of attribute enabled.



110
111
112
# File 'lib/ruby_llm/thinking.rb', line 110

def enabled
  @enabled
end

Class Method Details

.defaultObject



112
113
114
# File 'lib/ruby_llm/thinking.rb', line 112

def self.default
  new(intent: :enable)
end

.disabledObject



116
117
118
# File 'lib/ruby_llm/thinking.rb', line 116

def self.disabled
  new(intent: :disable)
end

Instance Method Details

#disabled?Boolean

Returns:

  • (Boolean)


132
133
134
# File 'lib/ruby_llm/thinking.rb', line 132

def disabled?
  enabled == false || effort == :none
end

#enabled?Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/ruby_llm/thinking.rb', line 128

def enabled?
  !@intent.nil? || !enabled.nil? || !effort.nil? || !budget.nil? || !display.nil?
end

#resolve(model) ⇒ Object

Raises:

  • (ArgumentError)


136
137
138
139
140
141
142
143
144
# File 'lib/ruby_llm/thinking.rb', line 136

def resolve(model)
  return self if @intent.nil?

  options = Controls.new(model).public_send(@intent)
  return nil if options == :already_on
  raise ArgumentError, resolution_error(model) unless options

  self.class.new(**options)
end