Module: OllamaChat::ThinkControl

Included in:
Chat
Defined in:
lib/ollama_chat/think_control.rb

Overview

A module that provides thinking control functionality for OllamaChat.

The ThinkControl module encapsulates methods for managing the 'think' mode setting in OllamaChat sessions. It handles the selection of different thinking modes, checking the current state, and displaying the current think mode status.

Constant Summary collapse

THINK_MODE_STATES =

An array of strings representing the valid configuration states for the thinking mode.

These states determine the level of reasoning or verbosity applied during the model's interaction.

The supported states are:

  • disabled: The thinking process is inactive.
  • enabled: The thinking process is active with default settings.
  • low: A minimal or subtle thinking intensity.
  • medium: A balanced approach to thinking and reasoning.
  • high: An intensive, detailed, or highly verbose thinking mode.
  • max: The maximum thinking intensity, where supported by the model. Some models treat high and max as equivalent (e.g., Qwen3.8 maps both to its xhigh reasoning effort).
%w[ disabled enabled low medium high max ]

Instance Method Summary collapse

Instance Method Details

#thinkString

The think method returns the current think mode selection.

Returns:

  • (String)

    the selected think mode value



28
29
30
31
32
33
34
35
36
# File 'lib/ollama_chat/think_control.rb', line 28

def think
  if think_mode.off?
    false
  elsif think_mode.selected == 'enabled'
    true
  else
    think_mode.selected
  end
end

#think?TrueClass, FalseClass

The think? method checks if the think mode is enabled.

Returns:

  • (TrueClass, FalseClass)

    true if think mode is enabled, false otherwise



41
42
43
# File 'lib/ollama_chat/think_control.rb', line 41

def think?
  think_mode.on?
end

#think_loud?TrueClass, FalseClass

The think_loud? method checks if both think mode and think loud mode are enabled.

Returns:

  • (TrueClass, FalseClass)

    true if think mode is enabled and think loud mode is on, false otherwise



50
51
52
# File 'lib/ollama_chat/think_control.rb', line 50

def think_loud?
  think? && think_loud.on?
end