Class: Ollama::Commands::Tags
- Inherits:
- 
      Object
      
        - Object
- Ollama::Commands::Tags
 
- Defined in:
- lib/ollama/commands/tags.rb
Overview
A command class that represents the tags API endpoint for Ollama.
This class is used to interact with the Ollama API’s tags endpoint, which retrieves information about locally available models. It inherits from the base command structure and provides the necessary functionality to execute tag listing requests.
Instance Attribute Summary collapse
- 
  
    
      #client  ⇒ Object 
    
    
  
  
  
  
    
    
      writeonly
    
  
  
  
  
  
  
    The client attribute writer allows setting the client instance associated with the object. 
- 
  
    
      #stream  ⇒ TrueClass, FalseClass 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The stream attribute reader returns the streaming behavior setting associated with the object. 
Class Method Summary collapse
- 
  
    
      .path  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The path method returns the API endpoint path for tag listing requests. 
Instance Method Summary collapse
- 
  
    
      #initialize(**parameters)  ⇒ Tags 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    The initialize method sets up a new instance with streaming disabled. 
- 
  
    
      #perform(handler)  ⇒ self 
    
    
  
  
  
  
  
  
  
  
  
    The perform method executes a command request using the specified handler. 
Constructor Details
#initialize(**parameters) ⇒ Tags
The initialize method sets up a new instance with streaming disabled.
This method is responsible for initializing a new object instance and configuring it with a default setting that disables streaming behavior. It is typically called during the object creation process to establish the initial state of the instance.
| 33 34 35 36 37 | # File 'lib/ollama/commands/tags.rb', line 33 def initialize(**parameters) parameters.empty? or raise ArgumentError, "Invalid parameters: #{parameters.keys * ' '}" @stream = false end | 
Instance Attribute Details
#client=(value) ⇒ Object (writeonly)
The client attribute writer allows setting the client instance associated with the object.
This method assigns the client that will be used to perform requests and handle responses for this command. It is typically called internally when a command is executed through a client instance.
| 54 55 56 | # File 'lib/ollama/commands/tags.rb', line 54 def client=(value) @client = value end | 
#stream ⇒ TrueClass, FalseClass (readonly)
The stream attribute reader returns the streaming behavior setting associated with the object.
whether streaming is enabled for the command execution
| 44 45 46 | # File 'lib/ollama/commands/tags.rb', line 44 def stream @stream end | 
Class Method Details
.path ⇒ String
The path method returns the API endpoint path for tag listing requests.
This class method provides the specific URL path used to interact with the Ollama API’s tags endpoint. It is utilized internally by the command structure to determine the correct API route for retrieving information about locally available models.
| 21 22 23 | # File 'lib/ollama/commands/tags.rb', line 21 def self.path '/api/tags' end | 
Instance Method Details
#perform(handler) ⇒ self
The perform method executes a command request using the specified handler.
This method initiates a request to the Ollama API endpoint associated with the command, utilizing the client instance to send the request and process responses through the provided handler. It handles both streaming and non-streaming scenarios based on the command’s configuration.
| 66 67 68 | # File 'lib/ollama/commands/tags.rb', line 66 def perform(handler) @client.request(method: :get, path: self.class.path, stream:, handler:) end |