Class: ActiveAgent::Providers::RubyLLM::ToolProxy
- Inherits:
-
Object
- Object
- ActiveAgent::Providers::RubyLLM::ToolProxy
- Defined in:
- lib/active_agent/providers/ruby_llm/tool_proxy.rb
Overview
Bridges ActiveAgent tool definitions to RubyLLM’s expected tool interface. RubyLLM expects tools as { “name” => tool } where each tool responds to #name, #description, #parameters, #params_schema, and #provider_params.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
Instance Method Summary collapse
-
#initialize(name:, description:, parameters:) ⇒ ToolProxy
constructor
A new instance of ToolProxy.
-
#params_schema ⇒ Object
RubyLLM checks this first; returns the JSON Schema directly so RubyLLM doesn’t try to interpret our parameters as Parameter objects.
-
#provider_params ⇒ Object
RubyLLM merges this into the tool definition.
Constructor Details
#initialize(name:, description:, parameters:) ⇒ ToolProxy
Returns a new instance of ToolProxy.
12 13 14 15 16 |
# File 'lib/active_agent/providers/ruby_llm/tool_proxy.rb', line 12 def initialize(name:, description:, parameters:) @name = name @description = description @parameters = parameters end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
10 11 12 |
# File 'lib/active_agent/providers/ruby_llm/tool_proxy.rb', line 10 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/active_agent/providers/ruby_llm/tool_proxy.rb', line 10 def name @name end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
10 11 12 |
# File 'lib/active_agent/providers/ruby_llm/tool_proxy.rb', line 10 def parameters @parameters end |
Instance Method Details
#params_schema ⇒ Object
RubyLLM checks this first; returns the JSON Schema directly so RubyLLM doesn’t try to interpret our parameters as Parameter objects. Deep-stringifies keys to match RubyLLM’s internal schema format.
21 22 23 |
# File 'lib/active_agent/providers/ruby_llm/tool_proxy.rb', line 21 def params_schema deep_stringify(@parameters) if @parameters.is_a?(Hash) && @parameters.any? end |
#provider_params ⇒ Object
RubyLLM merges this into the tool definition
26 27 28 |
# File 'lib/active_agent/providers/ruby_llm/tool_proxy.rb', line 26 def provider_params {} end |