Class SemanticMatching

java.lang.Object
org.mockserver.llm.semantic.SemanticMatching

public final class SemanticMatching extends Object
Process-wide opt-in gate for semantic prompt matching. A SemanticPromptMatcher is installed only when the operator sets mockserver.llmSemanticMatchingEnabled AND a runtime LLM backend resolves (done at server start). Until then isEnabled() is false and the semanticMatch conversation predicate is ignored — deterministic matching is never affected by default.

This is deliberately a static holder (like the telemetry and metrics holders) so the matcher on the request path can consult it without constructor wiring.

  • Method Details

    • install

      public static void install(SemanticPromptMatcher semanticPromptMatcher)
    • clear

      public static void clear()
    • isEnabled

      public static boolean isEnabled()
      True only when semantic matching has been explicitly enabled and wired.
    • matches

      public static boolean matches(String subject, String expectedMeaning)
      Evaluate the semantic match. Returns false (fail-closed) when not enabled or on any error — callers should guard with isEnabled() to distinguish "disabled, ignore the predicate" from "enabled, did not match".