Class: LLM::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/shell/version.rb,
lib/llm/shell/markdown.rb,
lib/llm/shell/renderer.rb,
lib/llm/shell/formatter.rb,
lib/llm/shell/completion.rb,
lib/llm/shell/options.rb,
lib/llm/shell/default.rb,
lib/llm/shell/command.rb,
lib/llm/shell/config.rb,
lib/llm/shell/repl.rb,
lib/llm/shell.rb

Defined Under Namespace

Classes: Command, Completion, Config, Default, Formatter, Markdown, Options, REPL, Renderer

Constant Summary collapse

VERSION =
"0.7.0"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ LLM::Shell

Parameters:

  • options (Hash)


48
49
50
51
52
53
# File 'lib/llm/shell.rb', line 48

def initialize(options)
  @config  = Config.new(options[:provider])
  @options = Options.new @config.merge(options), Default.new(options[:provider])
  @bot  = LLM::Bot.new(llm, {tools:}.merge(@options.bot))
  @repl = REPL.new(bot: @bot, options: @options)
end

Class Method Details

.homeString

Returns:

  • (String)


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

def self.home
  File.join Dir.home, ".llm-shell"
end

.toolsArray<String>

Returns:

  • (Array<String>)


35
36
37
# File 'lib/llm/shell.rb', line 35

def self.tools
  Dir[File.join(home, "tools", "*.rb")]
end

.commandsArray<String>

Returns:

  • (Array<String>)


41
42
43
# File 'lib/llm/shell.rb', line 41

def self.commands
  Dir[File.join(home, "commands", "*.rb")]
end

Instance Method Details

#startvoid

This method returns an undefined value.

Start the shell



58
59
60
61
# File 'lib/llm/shell.rb', line 58

def start
  repl.setup
  repl.start
end