Module: EasyTalk::Extensions::RubyLLMToolOverrides

Defined in:
lib/easy_talk/extensions/ruby_llm_compatibility.rb

Overview

Overrides for classes that inherit from RubyLLM::Tool. Only overrides schema-related methods, allowing all other RubyLLM::Tool functionality (halt, call, etc.) to work normally.

Usage: class WeatherTool < RubyLLM::Tool include EasyTalk::Model

define_schema do
  description 'Gets current weather'
  property :latitude, String
  property :longitude, String
end

def execute(latitude:, longitude:)
  # Can use halt() since we inherit from RubyLLM::Tool
  halt "Weather at #{latitude}, #{longitude}"
end

end

Instance Method Summary collapse

Instance Method Details

#descriptionString

Override to use EasyTalk's schema description.

Returns:

  • (String)

    The tool description from EasyTalk schema



45
46
47
48
# File 'lib/easy_talk/extensions/ruby_llm_compatibility.rb', line 45

def description
  schema_def = self.class.schema_definition
  schema_def.schema[:description] || "Tool: #{self.class.name}"
end

#params_schemaHash

Override to use EasyTalk's JSON schema for parameters.

Returns:

  • (Hash)

    The JSON schema for parameters



53
54
55
# File 'lib/easy_talk/extensions/ruby_llm_compatibility.rb', line 53

def params_schema
  self.class.json_schema
end