Class: Ollama::Tool
Overview
Represents a tool definition used in interactions with the Ollama API. This class encapsulates the structure required for defining tools that can be passed to models to enable function calling capabilities. It includes the type of tool and the associated function definition, which specifies the tool's name, description, parameters, and required fields.
Defined Under Namespace
Classes: Function
Instance Attribute Summary collapse
-
#function ⇒ Hash
readonly
The function attribute reader returns the function definition associated with the tool.
-
#type ⇒ String
readonly
The type attribute reader returns the type associated with the tool.
Instance Method Summary collapse
-
#initialize(type:, function:) ⇒ Tool
constructor
The initialize method sets up a new Tool instance with the specified type and function.
Methods included from DTO
#==, #as_array, #as_array_of_hashes, #as_hash, #as_json, #empty?, #to_json
Constructor Details
#initialize(type:, function:) ⇒ Tool
The initialize method sets up a new Tool instance with the specified type and function.
associated with the tool
42 43 44 |
# File 'lib/ollama/tool.rb', line 42 def initialize(type:, function:) @type, @function = type, function.to_hash end |
Instance Attribute Details
#function ⇒ Hash (readonly)
The function attribute reader returns the function definition associated with the tool.
as the function's name, description, parameters, and required fields
34 35 36 |
# File 'lib/ollama/tool.rb', line 34 def function @function end |
#type ⇒ String (readonly)
The type attribute reader returns the type associated with the tool.
calling capabilities
27 28 29 |
# File 'lib/ollama/tool.rb', line 27 def type @type end |