Package org.mockserver.llm
Class PromptNormalizer
java.lang.Object
org.mockserver.llm.PromptNormalizer
Deterministic normalisation of LLM prompt text prior to conversation-predicate
matching. Pure and side-effect-free: the same input plus options always yields
the same output, so normalised matching never makes a test flaky.
When the input parses as JSON, structural operations (key sorting, field dropping) are applied to the parsed tree; otherwise the input is treated as plain text. The text path never throws — any parse failure falls back to text-only normalisation.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringnormalize(String text, NormalizationOptions options) Normalisetextaccording tooptions.
-
Method Details
-
normalize
Normalisetextaccording tooptions. A nulloptions(or nulltext) returns the input unchanged.- Parameters:
text- the prompt text to normalise (may be null)options- the normalisation options (may be null)- Returns:
- the normalised text, never throwing
-