Class: Ollama::Commands::Show
- Inherits:
- 
      Object
      
        - Object
- Ollama::Commands::Show
 
- Includes:
- DTO
- Defined in:
- lib/ollama/commands/show.rb
Overview
A command class that represents the show API endpoint for Ollama.
This class is used to interact with the Ollama API’s show endpoint, which retrieves detailed information about a specific model. It inherits from the base command structure and provides the necessary functionality to execute show requests for model details.
Instance Attribute Summary collapse
- 
  
    
      #client  ⇒ Object 
    
    
  
  
  
  
    
    
      writeonly
    
  
  
  
  
  
  
    The client attribute writer allows setting the client instance associated with the object. 
- 
  
    
      #model  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The model attribute reader returns the model name associated with the object. 
- 
  
    
      #stream  ⇒ TrueClass, FalseClass 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The stream attribute reader returns the streaming behavior setting associated with the object. 
- 
  
    
      #verbose  ⇒ TrueClass, ... 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The verbose attribute reader returns the verbose setting associated with the object. 
Class Method Summary collapse
- 
  
    
      .path  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The path method returns the API endpoint path for show requests. 
Instance Method Summary collapse
- 
  
    
      #initialize(model:, verbose: nil)  ⇒ Show 
    
    
  
  
  
    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. 
Methods included from DTO
#==, #as_array, #as_array_of_hashes, #as_hash, #as_json, #empty?, #to_json
Constructor Details
#initialize(model:, verbose: nil) ⇒ Show
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.
TrueClass, FalseClass, nil ] whether to enable verbose output, or nil to use default
| 36 37 38 39 | # File 'lib/ollama/commands/show.rb', line 36 def initialize(model:, verbose: nil) @model, @verbose = model, verbose @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.
| 68 69 70 | # File 'lib/ollama/commands/show.rb', line 68 def client=(value) @client = value end | 
#model ⇒ String (readonly)
The model attribute reader returns the model name associated with the object.
| 44 45 46 | # File 'lib/ollama/commands/show.rb', line 44 def model @model end | 
#stream ⇒ TrueClass, FalseClass (readonly)
The stream attribute reader returns the streaming behavior setting associated with the object.
| 58 59 60 | # File 'lib/ollama/commands/show.rb', line 58 def stream @stream end | 
#verbose ⇒ TrueClass, ... (readonly)
The verbose attribute reader returns the verbose setting associated with the object.
| 51 52 53 | # File 'lib/ollama/commands/show.rb', line 51 def verbose @verbose end | 
Class Method Details
.path ⇒ String
The path method returns the API endpoint path for show requests.
This class method provides the specific URL path used to interact with the Ollama API’s show endpoint. It is utilized internally by the command structure to determine the correct API route for retrieving detailed information about a specific model.
| 22 23 24 | # File 'lib/ollama/commands/show.rb', line 22 def self.path '/api/show' 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.
| 80 81 82 | # File 'lib/ollama/commands/show.rb', line 80 def perform(handler) @client.request(method: :post, path: self.class.path, body: to_json, stream:, handler:) end |