Class: RubyLLM::Tools::ProviderTools::Resolution
- Inherits:
-
Object
- Object
- RubyLLM::Tools::ProviderTools::Resolution
- Defined in:
- lib/ruby_llm/tools/provider_tools.rb
Overview
The result of resolving a chat's provider tools against a protocol's alias table: tool entries for the payload's tools slot, extra payload fields to merge, and request headers to add.
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Instance Method Summary collapse
- #add(spec, options) ⇒ Object
- #add_raw(hash) ⇒ Object
-
#initialize ⇒ Resolution
constructor
A new instance of Resolution.
Constructor Details
#initialize ⇒ Resolution
Returns a new instance of Resolution.
16 17 18 19 20 |
# File 'lib/ruby_llm/tools/provider_tools.rb', line 16 def initialize @tools = [] @payload = {} @headers = {} end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
14 15 16 |
# File 'lib/ruby_llm/tools/provider_tools.rb', line 14 def headers @headers end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
14 15 16 |
# File 'lib/ruby_llm/tools/provider_tools.rb', line 14 def payload @payload end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools.
14 15 16 |
# File 'lib/ruby_llm/tools/provider_tools.rb', line 14 def tools @tools end |
Instance Method Details
#add(spec, options) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ruby_llm/tools/provider_tools.rb', line 22 def add(spec, ) entry = spec.is_a?(Proc) ? spec.call( || {}) : (spec, ) @tools << entry[:tool] if entry[:tool] merge_payload(entry[:payload]) if entry[:payload] merge_headers(entry[:headers]) if entry[:headers] self end |
#add_raw(hash) ⇒ Object
30 31 32 33 |
# File 'lib/ruby_llm/tools/provider_tools.rb', line 30 def add_raw(hash) @tools << hash self end |