Class: LLM::Shell::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/shell/options.rb

Overview

The LLM::Shell::Options class represents the options provided to the shell at the command line, and the configuration file (if any). The command-line options take precedence over the configuration file.

Instance Method Summary collapse

Constructor Details

#initialize(options, default) ⇒ LLM::Shell::Options

Parameters:



14
15
16
17
18
19
20
21
22
# File 'lib/llm/shell/options.rb', line 14

def initialize(options, default)
  @options  = options.transform_keys(&:to_sym)
  @provider = @options.delete(:provider)
  @tools    = @options.delete(:tools)
  @prompt   = @options[:prompt] ? custom_prompt : default.prompt
  @files    = Dir[*@options.delete(:files) || []].reject { File.directory?(_1) }
  @bot_options = {model: @options.delete(:model)}.compact
  @default  = default
end

Instance Method Details

#promptObject



30
# File 'lib/llm/shell/options.rb', line 30

def prompt = File.read(@prompt)

#providerObject



24
# File 'lib/llm/shell/options.rb', line 24

def provider = @provider

#toolsObject



25
# File 'lib/llm/shell/options.rb', line 25

def tools = @tools

#filesObject



26
# File 'lib/llm/shell/options.rb', line 26

def files = @files

#llmObject



27
# File 'lib/llm/shell/options.rb', line 27

def llm = @options

#botObject



28
# File 'lib/llm/shell/options.rb', line 28

def bot = @bot_options

#defaultObject



29
# File 'lib/llm/shell/options.rb', line 29

def default = @default