Package org.mockserver.llm.client
Class LlmCompletionService
java.lang.Object
org.mockserver.llm.client.LlmCompletionService
Orchestrates an outbound completion against a real LLM backend: looks up the
per-provider
LlmClient, builds the request, sends it via the
LlmTransport, and parses the response into a Completion.
This is the single entry point used by runtime-LLM features (drift detection, semantic matching). It enforces the roadmap's safety rules:
- Off unless configured — callers resolve a backend via
LlmBackendResolver; with none, the feature is simply unavailable. - Fail closed — any timeout, transport error, non-2xx status, or
parse failure returns
Optional.empty()and logs one line. A flaky network must never flip an assertion. - Reproducible — clients pin
temperature=0/seed; responses are cached per (provider, model, base URL, normalised prompt) so a given input is stable within a run.
-
Constructor Summary
ConstructorsConstructorDescriptionLlmCompletionService(LlmTransport transport) LlmCompletionService(LlmTransport transport, LlmClientRegistry registry) -
Method Summary
Modifier and TypeMethodDescriptioncomplete(LlmBackend backend, ParsedConversation prompt) Complete the given prompt against the backend, orOptional.empty()if no client is registered for the provider or the call fails for any reason (fail-closed).
-
Constructor Details
-
LlmCompletionService
-
LlmCompletionService
-
-
Method Details
-
complete
Complete the given prompt against the backend, orOptional.empty()if no client is registered for the provider or the call fails for any reason (fail-closed). Never throws.
-