Class: Ollama::Tool::Function
- Inherits:
- 
      Object
      
        - Object
- Ollama::Tool::Function
 
- Includes:
- DTO
- Defined in:
- lib/ollama/tool/function.rb
Overview
A class that represents a function definition for tool usage in Ollama API interactions.
This class encapsulates the structure required for defining functions that can be passed to models to enable function calling capabilities. It includes the function’s name, description, parameters specification, and list of required parameters.
Defined Under Namespace
Classes: Parameters
Instance Attribute Summary collapse
- 
  
    
      #description  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The description attribute reader returns the description associated with the object. 
- 
  
    
      #name  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The name attribute reader returns the name associated with the object. 
- 
  
    
      #parameters  ⇒ Hash? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The parameters attribute reader returns the parameters associated with the object. 
- 
  
    
      #required  ⇒ Array<String>? 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The required attribute reader returns the required parameter values associated with the object. 
Instance Method Summary collapse
- 
  
    
      #initialize(name:, description:, parameters: nil, required: nil)  ⇒ Function 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    The initialize method sets up a new Tool::Function 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(name:, description:, parameters: nil, required: nil) ⇒ Function
The initialize method sets up a new Tool::Function instance with the specified attributes.
| 49 50 51 52 53 | # File 'lib/ollama/tool/function.rb', line 49 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
#description ⇒ String (readonly)
The description attribute reader returns the description associated with the object.
| 28 29 30 | # File 'lib/ollama/tool/function.rb', line 28 def description @description end | 
#name ⇒ String (readonly)
The name attribute reader returns the name associated with the object.
| 22 23 24 | # File 'lib/ollama/tool/function.rb', line 22 def name @name end | 
#parameters ⇒ Hash? (readonly)
The parameters attribute reader returns the parameters associated with the object.
| 34 35 36 | # File 'lib/ollama/tool/function.rb', line 34 def parameters @parameters end | 
#required ⇒ Array<String>? (readonly)
The required attribute reader returns the required parameter values associated with the object.
| 40 41 42 | # File 'lib/ollama/tool/function.rb', line 40 def required @required end |