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.
%w[ disabled enabled low medium high ]

Instance Method Summary collapse

Instance Method Details

#thinkString

The think method returns the current think mode selection.

Returns:

  • (String)

    the selected think mode value



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

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



39
40
41
# File 'lib/ollama_chat/think_control.rb', line 39

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



48
49
50
# File 'lib/ollama_chat/think_control.rb', line 48

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