Module: OllamaChat::Dialog

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

Overview

A module that provides interactive selection and configuration functionality for OllamaChat.

The Dialog module encapsulates various helper methods for choosing models, system prompts, document policies, and voices, as well as displaying information and managing chat sessions. It leverages user interaction components like choosers and prompts to enable dynamic configuration during runtime.

Examples:

Selecting a model from available options

chat.choose_model('-m llama3.1', 'llama3.1')

Changing the system prompt

chat.change_system_prompt('default_prompt', system: '?sherlock')

Instance Method Summary collapse

Instance Method Details

#ask?(prompt:) ⇒ String

The ask? method prompts the user with a question and returns their input.

Parameters:

  • prompt (String)

    the message to display to the user

Returns:

  • (String)

    the user’s response with trailing newline removed



21
22
23
24
# File 'lib/ollama_chat/dialog.rb', line 21

def ask?(prompt:)
  print prompt
  STDIN.gets.to_s.chomp
end