Module: Smith::Tool::ChatExecutionContext

Defined in:
lib/smith/tool/chat_execution_context.rb

Class Method Summary collapse

Class Method Details

.install(chat) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/smith/tool/chat_execution_context.rb', line 6

def self.install(chat)
  return chat unless chat.respond_to?(:tools) && chat.tools.respond_to?(:values)
  unless chat.respond_to?(:execute_tool, true)
    raise Error, "unsupported RubyLLM chat execution interface: missing #execute_tool"
  end

  chat.extend(self) unless chat.singleton_class < self
  chat.__send__(:install_smith_tool_execution_context)
  chat
end