Class: Ollama::Tool::Function

Inherits:
Object
  • Object
show all
Includes:
DTO
Defined in:
lib/ollama/tool/function.rb

Defined Under Namespace

Classes: Parameters

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DTO

#as_array_of_hashes, #as_json, #empty?, #to_json

Constructor Details

#initialize(name:, description:, parameters: nil, required: nil) ⇒ Function

Returns a new instance of Function.



6
7
8
9
10
# File 'lib/ollama/tool/function.rb', line 6

def initialize(name:, description:, parameters: nil, required: nil)
  @name, @description, @parameters, @required =
    name, description, (Hash(parameters) if parameters),
    (Array(required) if required)
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/ollama/tool/function.rb', line 4

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/ollama/tool/function.rb', line 4

def name
  @name
end

#parametersObject (readonly)

Returns the value of attribute parameters.



4
5
6
# File 'lib/ollama/tool/function.rb', line 4

def parameters
  @parameters
end

#requiredObject (readonly)

Returns the value of attribute required.



4
5
6
# File 'lib/ollama/tool/function.rb', line 4

def required
  @required
end