Class: Ollama::Handlers::NOP

Inherits:
Object
  • Object
show all
Includes:
Concern
Defined in:
lib/ollama/handlers/nop.rb

Overview

A handler that performs no operation on responses.

The NOP (No Operation) handler is used when it's necessary to pass a handler object to a command without actually processing or displaying the responses. It implements the required interface for response handling but takes no action when called, making it useful for scenarios where a handler is required by the API but no specific processing is desired.

Examples:

Using the NOP handler

ollama.generate(model: 'llama3.1', prompt: 'Hello World', &NOP)

Instance Attribute Summary

Attributes included from Concern

#output, #result

Instance Method Summary collapse

Methods included from Concern

#initialize, #to_proc

Instance Method Details

#call(response) ⇒ self

The call method processes a response and returns the handler instance.

This method is intended to be overridden by concrete handler implementations to define specific behavior for handling API responses. It serves as the core interface for response processing within the handler pattern.

Parameters:

  • response (Ollama::Response)

    the response object to be processed by the handler

Returns:

  • (self)

    returns the handler instance itself after processing the response



24
25
26
# File 'lib/ollama/handlers/nop.rb', line 24

def call(response)
  self
end