Class: Async::Ollama::Tool
- Inherits:
-
Object
- Object
- Async::Ollama::Tool
- Defined in:
- lib/async/ollama/toolbox.rb
Overview
Represents a tool that can be registered and called by the Toolbox.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
- #The name of the tool.(nameofthetool.) ⇒ Object readonly
Instance Method Summary collapse
-
#call(message) ⇒ Object
Calls the tool with the given message.
- #explain ⇒ Object
-
#initialize(name, schema, &block) ⇒ Tool
constructor
Initializes a new tool with the given name, schema, and block.
- #The schema for the tool.=(schema) ⇒ Object
Constructor Details
#initialize(name, schema, &block) ⇒ Tool
Initializes a new tool with the given name, schema, and block.
14 15 16 17 18 |
# File 'lib/async/ollama/toolbox.rb', line 14 def initialize(name, schema, &block) @name = name @schema = schema @block = block end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
21 22 23 |
# File 'lib/async/ollama/toolbox.rb', line 21 def name @name end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
24 25 26 |
# File 'lib/async/ollama/toolbox.rb', line 24 def schema @schema end |
#The name of the tool.(nameofthetool.) ⇒ Object (readonly)
21 |
# File 'lib/async/ollama/toolbox.rb', line 21 attr :name |
Instance Method Details
#call(message) ⇒ Object
Calls the tool with the given message.
29 30 31 |
# File 'lib/async/ollama/toolbox.rb', line 29 def call() @block.call() end |
#explain ⇒ Object
34 35 36 37 38 39 |
# File 'lib/async/ollama/toolbox.rb', line 34 def explain { type: "function", function: @schema, } end |
#The schema for the tool.=(schema) ⇒ Object
24 |
# File 'lib/async/ollama/toolbox.rb', line 24 attr :schema |