Class: Brute::Tools::Question

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/brute/tools/question.rb

Instance Method Summary collapse

Instance Method Details

#execute(questions:) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/brute/tools/question.rb', line 49

def execute(questions:)
  handler = Thread.current[:on_question]
  unless handler
    return { error: true, message: "Cannot ask questions in non-interactive mode" }
  end

  queue = Queue.new
  handler.call(questions, queue)
  answers = queue.pop

  format_answers(questions, answers)
end

#nameObject



47
# File 'lib/brute/tools/question.rb', line 47

def name; "question"; end