Package org.mockserver.llm.drift
Class DriftDetector
java.lang.Object
org.mockserver.llm.drift.DriftDetector
Replays recorded LLM request/response exchanges against a live provider and
reports structural drift in the responses (new/removed fields, type
changes) — closing the loop on stale VCR cassettes.
Drift is structural, not semantic: it compares response shape, not
values, so it never flags benign wording changes. Each exchange fails closed
independently — a network error or non-2xx live response is reported as
COULD_NOT_CHECK, never as drift and never thrown. The detector takes
an injected LlmTransport so it unit-tests offline; the live HTTP call
is only made when a backend is configured (opt-in).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA recorded request and the body of its recorded response. -
Constructor Summary
ConstructorsConstructorDescriptionDriftDetector(LlmClientRegistry clientRegistry, ProviderCodecRegistry codecRegistry, LlmTransport transport, long timeoutMillis) DriftDetector(LlmTransport transport, long timeoutMillis) -
Method Summary
Modifier and TypeMethodDescriptiondetect(List<DriftDetector.RecordedExchange> exchanges, Provider provider, LlmBackend backend) Replay each recorded exchange againstbackendand diff the live response shape against the recorded one.
-
Constructor Details
-
DriftDetector
-
DriftDetector
public DriftDetector(LlmClientRegistry clientRegistry, ProviderCodecRegistry codecRegistry, LlmTransport transport, long timeoutMillis)
-
-
Method Details
-
detect
public DriftReport detect(List<DriftDetector.RecordedExchange> exchanges, Provider provider, LlmBackend backend) Replay each recorded exchange againstbackendand diff the live response shape against the recorded one. Never throws.
-