---
title: "ADR-331: A default configuration's adapter is built from its model record"
manual: "LLM Foundation"
version: "main"
permalink: "https://docs.typo3.org/permalink/netresearch/nr-llm:adr-331@main"
source: "Adr/Adr331ADefaultConfigurationsAdapterIsBuiltFromItsModelRecord.rst"
rendered: "2026-12-02T02:58:30+00:00"
---

# ADR-331: A default configuration's adapter is built from its model record {#adr-331}

-   *Status:* Accepted (the criteria-mode limit is lifted — see [ADR-332](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-332@main); a criteria-mode default is returned without a model — see [ADR-333](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-333@main))
-   *Date:* 2026-11-29
-   *Amended:* 2026-11-29 by [ADR-332](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-332@main); 2026-12-01 by [ADR-333](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-333@main)
-   *Authors:* Netresearch DTT GmbH

## Context {#context}

Without a pinned provider, `vision()`, `embed()` and
`DocumentAnalysisService::analyzeDocument()` fall back to the default
configuration, or for document analysis to the configuration a site names. All
three then took the provider record's ADAPTER TYPE (`anthropic`,
`custom`) and used it as a key into `KeyedProviderRegistry`. That
registry is keyed by `ProviderInterface::getIdentifier()`, the adapter's
own name: `claude` for the adapter type `anthropic`, `openai` for
`custom`, `together`, `fireworks` and `perplexity`. The two are
different namespaces, so `vision()` and the document probe on an Anthropic
default failed with `Provider "anthropic" not found`, and `embed()` on
an OpenAI-compatible default with `Provider "custom" not found` (or the
type it names). This is the follow-up to
[#873](https://github.com/netresearch/t3x-nr-llm/issues/873), which had
handed the registry the record's row identifier and was fixed by switching to
the adapter type.

Where the names happen to match (`openai`, `gemini`, `mistral`,
`groq`, `openrouter`, `ollama`), the call did run,
but on the keyed adapter. That adapter is configured from the extension
configuration, not from the provider record's vault key and endpoint, so a
matching key was a second defect, not a correct path.

`chat()` never had the problem: `chatWithConfiguration()` builds the
adapter from the model record the configuration resolves to, through
`ProviderAdapterRegistry::createAdapterFromModel()`.
[ADR-055](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-055@main) put embeddings on that configuration path for a named
configuration; the default-configuration branch of `embed()` did not use it.

`DocumentAnalysisService` is an `@api` final class. It holds
`LlmServiceManagerInterface`, which offers no way to build the adapter of
a model record, so the service cannot reach the right adapter without a new
dependency. The owner decided on 2026-11-29 to give it one as an optional
trailing constructor argument.

## Decision {#decision}

**1\. A default configuration's adapter is built from its model record, as**
`chat()` **builds it.** `embed()` hands a resolved default configuration
to `LlmServiceManager::embedForConfiguration()`. `vision()` resolves
the model on each attempt through
`ConfigurationCallPlanner::resolveModel()`, so a fallback sibling resolves
its own, and builds the adapter with
`ProviderAdapterRegistryInterface::createAdapterFromModel()`. A model named
by the caller is kept. A pinned provider is a keyed name and is still looked up
in the keyed registry.

**2\. DocumentAnalysisService takes an optional trailing**
`?ProviderAdapterRegistryInterface $adapterRegistry = null` **constructor
argument.** The container injects it. With it, the capability probe
(`probeProvider()`) builds the adapter of the configuration's model record;
without it, or for a pinned provider, the probe asks the keyed registry as
before. A trailing parameter with a default is additive on the constructor of
a final class (`Classes/AGENTS.md`, [API stability](https://docs.typo3.org/permalink/netresearch/nr-llm:api-stability@main)): no caller
breaks and nothing can override it. The API snapshot
(`Tests/Unit/Api/api-surface.txt`) records the new signature, and the
change has an `added` changelog fragment.

## Consequences {#consequences}

-   ●● `vision()` and the document probe work for a default configuration on
    an Anthropic provider; `vision()` and `embed()` work for a default
    configuration on a Custom, Together, Fireworks or Perplexity provider, and on
    an Azure OpenAI provider, whose adapter the keyed registry never held
    (`AzureOpenAiProvider` carries no `#[AsLlmProvider]` of its own). `embed()` on an
    Anthropic default reports that Claude does not support embeddings instead of
    `Provider "anthropic" not found`.
-   ● A default configuration on an OpenAI, Gemini, Mistral, Groq, OpenRouter or
    Ollama provider now runs `vision()` and `embed()` with the provider
    record's own API key and endpoint, as `chat()` does, instead of the
    adapter configured from the extension configuration. An installation that
    relied on the extension configuration's key for these two calls now uses the
    record's key.
-   ◐ No public signature breaks; the release raises only the last version
    number.
-   ◑ A `DocumentAnalysisService` constructed by hand without the new
    argument keeps the keyed lookup, and with it the old failure for an
    Anthropic configuration. Nothing warns about that.
-   ✕ Known limit, unchanged by this decision: a criteria-mode configuration
    named by a site still fails in `DocumentAnalysisService::probeProvider()`.
    Such a configuration has no directly assigned model
    (`getLlmModel()` is null; it resolves its model at call time,
    [ADR-066](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-066@main)), so the probe falls through to the keyed lookup
    with no key, and `KeyedProviderRegistry::getProvider()` throws
    `No provider specified and no default provider configured`. The default
    configuration is not affected, because the resolver only returns a default
    that has a model. [ADR-332](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-332@main) lifts this limit: the probe
    selects the model of such a configuration. Since [ADR-333](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-333@main)
    the resolver also returns a criteria-mode default without a model.

Net Score: +2.5

## Alternatives considered {#alternatives-considered}

**Downcast to** `LlmServiceManager` **and call**
`getAdapterFromConfiguration()`. Rejected: the service holds the interface.
A decorator or a test double of `LlmServiceManagerInterface` fails the
`instanceof` check, and the probe would silently fall back to the keyed
lookup, which is the defect this record removes.

**A new method on** `LlmServiceManagerInterface` **that returns the
adapter of a configuration.** Rejected: a new method on an `@api` interface
is a breaking change ([API stability](https://docs.typo3.org/permalink/netresearch/nr-llm:api-stability@main)), which during 0.x raises the
middle version number and makes every dependent extension widen its
constraint, for a bug fix.

**Translate the adapter type into the keyed identifier** (`anthropic` to
`claude`, `custom` to `openai`). Rejected: the keyed adapter is
configured from the extension configuration, so the call would still run
without the provider record's key and endpoint.
