ADR-066: Criteria-mode configurations resolve in the service layer
- Status
-
Accepted
- Date
-
2026-07-15
- Authors
-
Netresearch DTT GmbH
Context
ADR-055 and ADR-056 introduced
Llm records with two selection modes: fixed (a
direct model_ relation) and criteria (a stored
Model JSON; model_, the concrete model
chosen at call time). Model was the
resolver — but it had no production caller. Every
*For entry point (embed,
chat, chat,
complete, stream) obtained
its adapter through get, which read
$configuration->get — a plain getter — directly. For a
criteria-mode record that relation is null, so the call threw
Provider.
This surfaced live: nr_ai_search's embedding /
chat presets are criteria-mode, so the entire retrieval
path failed the moment it reached the provider adapter.
Decision
get — the single adapter choke point for
every *For path — resolves the model through
Model, which returns
the directly configured model unchanged for fixed mode and selects
from the stored criteria for criteria mode. It still throws the same
Provider (code 1735300100) when resolution yields no
model.
The resolved model is not written back onto the configuration. The
configuration is a repository-managed Extbase entity; calling
set would mark it dirty and Extbase would persist
model_ at request end, silently converting a criteria-mode record
into a fixed-mode one. Per-model cost analytics for criteria configs
(Usage reads get directly) therefore remain a
separate, non-destructive follow-up.
Consequences
- Criteria-mode configurations work across embed / chat / tools / complete / stream without the caller pre-resolving a model.
Modelis a trailing, nullable constructor dependency ofSelection Service Interface Llm(autowired); when absent the method falls back to the raw getter, so existing 5-argument constructions keep compiling.Service Manager - Cost analytics for criteria-mode configs fall back to the provider-reported model id (no per-model DB pricing) until the follow-up threads the resolved model through the call metadata.
See PR #372.