Class: Ollama::Tool::Function::Parameters
- Inherits:
-
Object
- Object
- Ollama::Tool::Function::Parameters
- Includes:
- DTO
- Defined in:
- lib/ollama/tool/function/parameters.rb
Overview
A class that represents the parameters specification for a tool function in Ollama API interactions.
This class encapsulates the structure required for defining the parameters that a function tool accepts. It includes the type of parameter object, the properties of each parameter, and which parameters are required.
Defined Under Namespace
Classes: Property
Instance Attribute Summary collapse
-
#properties ⇒ Hash
readonly
The properties attribute reader returns the properties associated with the object.
-
#required ⇒ Array<String>?
readonly
The required attribute reader returns the required parameter values associated with the object.
-
#type ⇒ String
readonly
The type attribute reader returns the type associated with the object.
Instance Method Summary collapse
-
#initialize(type:, properties:, required:) ⇒ Parameters
constructor
The initialize method sets up a new Parameters instance with the specified attributes.
Methods included from DTO
#==, #as_array, #as_array_of_hashes, #as_hash, #as_json, #empty?, #to_json
Constructor Details
#initialize(type:, properties:, required:) ⇒ Parameters
The initialize method sets up a new Parameters instance with the specified attributes.
45 46 47 48 |
# File 'lib/ollama/tool/function/parameters.rb', line 45 def initialize(type:, properties:, required:) @type, @properties, @required = type, Hash(properties).transform_values(&:to_hash), Array(required) end |
Instance Attribute Details
#properties ⇒ Hash (readonly)
The properties attribute reader returns the properties associated with the object.
30 31 32 |
# File 'lib/ollama/tool/function/parameters.rb', line 30 def properties @properties end |
#required ⇒ Array<String>? (readonly)
The required attribute reader returns the required parameter values associated with the object.
if not set
37 38 39 |
# File 'lib/ollama/tool/function/parameters.rb', line 37 def required @required end |
#type ⇒ String (readonly)
The type attribute reader returns the type associated with the object.
24 25 26 |
# File 'lib/ollama/tool/function/parameters.rb', line 24 def type @type end |