LLM::AdapterFactory
Factory for creating LLM adapters based on provider configuration.
Class methods
The anthropic preset, an Anthropic host, or any URL already naming
the Messages endpoint. An Anthropic URL that names
/chat/completions asked for the OpenAI-compatible layer and gets it.
The native API lives at the server root. A URL ending in /v1 names
the OpenAI-compatible mount: appending /api/generate to it yields a
404, so it is dropped before LLM::Ollama builds the endpoint URL.
Ollama's native API (POST /api/generate) is a different protocol and a
different body shape from the OpenAI-compatible /v1/chat/completions
every other provider speaks, so this decision has to be precise.
It used to be provider.downcase.includes?("ollama") tested against the
whole provider string. A path segment is chosen by whoever runs the
gateway, so an OpenAI-compatible endpoint mounted at
http://gw.example/ollama/v1 was handed the wrong API — and, because
the same full string is used as the base URL, the request went to
http://gw.example/ollama/v1/api/generate. The 404 came back as an
empty result rather than an error.
Only the exact alias and the host decide now. A host named ollama
that is explicitly serving the compatibility path is still an
OpenAI-compatible endpoint.