Class: Brainchat::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/brainchat/cli.rb

Overview

Thor command-line interface. ask retrieves chunks via rag-query and streams the cited answer to stdout.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


11
# File 'lib/brainchat/cli.rb', line 11

def self.exit_on_failure? = true

Instance Method Details

#ask(question) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/brainchat/cli.rb', line 39

def ask(question)
  chunks = retrieve(question)
  answer(question, chunks)
  print_sources(chunks)
rescue Error => e
  warn e.message
  exit 1
end