Class NormalizationOptions


public class NormalizationOptions extends ObjectWithJsonToString
Opt-in normalisation applied to LLM prompt text before ConversationPredicates substring/regex comparisons are evaluated.

Agent prompts are dynamically assembled, so exact-byte matching is brittle. Normalisation makes matching tolerant of cosmetic differences (whitespace, JSON key ordering, volatile ids/timestamps) while remaining fully deterministic — the same input always normalises to the same output.

Boolean options are nullable on purpose: an unset (null) flag means "use the default", and that default is applied uniformly wherever the options are consumed (see PromptNormalizer). This keeps the behaviour identical whether the options arrive via the REST/JSON API (Jackson leaves absent fields null) or the MCP tool (which sets only the fields present in the request). Defaults: collapseWhitespace and sortJsonKeys on; lowercase and dropBuiltInVolatileFields off.

Follows the same field/withX/getter convention as the other model classes (Completion, ConversationPredicates) so it round-trips through the MockServer JSON API without a bespoke (de)serializer.

  • Field Details

    • DEFAULT_COLLAPSE_WHITESPACE

      public static final boolean DEFAULT_COLLAPSE_WHITESPACE
      See Also:
    • DEFAULT_LOWERCASE

      public static final boolean DEFAULT_LOWERCASE
      See Also:
    • DEFAULT_SORT_JSON_KEYS

      public static final boolean DEFAULT_SORT_JSON_KEYS
      See Also:
    • DEFAULT_DROP_BUILT_IN_VOLATILE_FIELDS

      public static final boolean DEFAULT_DROP_BUILT_IN_VOLATILE_FIELDS
      See Also:
  • Constructor Details

    • NormalizationOptions

      public NormalizationOptions()
  • Method Details

    • normalizationOptions

      public static NormalizationOptions normalizationOptions()
      Returns an options object with all flags unset — i.e. the defaults (whitespace collapsing and JSON key sorting on, lowercasing and volatile-field stripping off) apply when it is consumed.
    • withCollapseWhitespace

      public NormalizationOptions withCollapseWhitespace(boolean collapseWhitespace)
    • getCollapseWhitespace

      public Boolean getCollapseWhitespace()
    • withLowercase

      public NormalizationOptions withLowercase(boolean lowercase)
    • getLowercase

      public Boolean getLowercase()
    • withSortJsonKeys

      public NormalizationOptions withSortJsonKeys(boolean sortJsonKeys)
    • getSortJsonKeys

      public Boolean getSortJsonKeys()
    • withDropBuiltInVolatileFields

      public NormalizationOptions withDropBuiltInVolatileFields(boolean dropBuiltInVolatileFields)
      When true, strip a built-in set of volatile values from the text before matching: ISO-8601 timestamps, UUIDs, and prefix_… style ids (e.g. req_…, msg_…, call_…).
    • getDropBuiltInVolatileFields

      public Boolean getDropBuiltInVolatileFields()
    • withDropVolatileFields

      public NormalizationOptions withDropVolatileFields(List<String> dropVolatileFields)
      Names of JSON fields to drop from the prompt before matching (applied when the prompt text is valid JSON). Use for caller-specific volatile fields not covered by withDropBuiltInVolatileFields(boolean).
    • getDropVolatileFields

      public List<String> getDropVolatileFields()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class ObjectWithReflectiveEqualsHashCodeToString
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ObjectWithReflectiveEqualsHashCodeToString