Class: Brute::Tools::Question

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

Instance Method Summary collapse

Instance Method Details

#call(questions:) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/brute/tools/question.rb', line 37

def call(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