Class: Ollama::Base

Inherits:
Middleware
  • Object
show all
Defined in:
lib/ollama/policies/base.rb

Overview

Production-behavior middleware policies (retry, timeout, auto-pull, ...).

Policies implement Ollama::Middleware's #around(request, env, &block) contract and are attached to a client with:

client.use(Ollama::Policies::Retry, max_attempts: 3)
client.use(Ollama::Policies::Timeout, read_timeout: 30)

The chain is assembled by Ollama::Pipeline (see Pipeline::ChainLink): each policy's block is the next link (another policy or the transport).

Policies operate on Transport::Request objects (method/uri/headers/body), not the higher-level Ollama::Request, so the shared helpers below derive endpoint/model/body data from the URI and JSON body.