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.

Instance Method Summary collapse

Instance Method Details

#thinkString

The think method returns the current think mode selection.

Returns:

  • (String)

    the selected think mode value



11
12
13
14
15
16
17
18
19
# File 'lib/ollama_chat/think_control.rb', line 11

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



24
25
26
# File 'lib/ollama_chat/think_control.rb', line 24

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



33
34
35
# File 'lib/ollama_chat/think_control.rb', line 33

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