Class LlmConversationMatcher


  • public class LlmConversationMatcher
    extends Object
    Matches inbound HTTP requests against LLM conversation predicates. All predicates compose with AND semantics. Parse failures and oversize bodies are treated as no-match (fail-closed) without throwing.
    • Constructor Detail

      • LlmConversationMatcher

        public LlmConversationMatcher()
    • Method Detail

      • getTurnIndex

        public Integer getTurnIndex()
      • getLatestMessageContains

        public String getLatestMessageContains()
      • withLatestMessageMatches

        public LlmConversationMatcher withLatestMessageMatches​(String regexSource)
        Set regex from a source string. The pattern is compiled eagerly so that syntactically-invalid regexes are rejected at configuration time (not at match time). Throws PatternSyntaxException wrapped in IllegalArgumentException if the regex does not compile.
        Parameters:
        regexSource - the regex source string
        Returns:
        this matcher
        Throws:
        IllegalArgumentException - if the regex source is syntactically invalid
      • getLatestMessageMatches

        public Pattern getLatestMessageMatches()
      • getLatestMessageMatchesSource

        public String getLatestMessageMatchesSource()
      • getContainsToolResultFor

        public String getContainsToolResultFor()
      • getProvider

        public Provider getProvider()
      • hasPredicates

        public boolean hasPredicates()
        Returns true if any predicate is configured on this matcher.
      • matches

        public boolean matches​(HttpRequest request)
        Matches the given request against all configured predicates. Returns true if no predicates are set. Returns false on parse failure, oversize body, missing codec, or any predicate mismatch. Never throws.