MatchGuards
Ready-made guard sets for dev.kmemo.SemanticCache.
Pick by how much a wrong answer costs you:
| Preset | Use when |
|---|---|
| standard | Default. Every guard that pays for itself, tuned to reject no genuine paraphrase. |
| longPrompts | Prompts carry retrieved context. Bounds the one guard that misfires on them. |
| strict | A wrong answer is expensive. Trades hit rate for margin. |
| none | Similarity alone. Only with a dev.kmemo.Verifier, or a private benchmark. |
standard takes an optional GuardVocabulary or language code, so the same guards run against another language's markers — see Vocabularies for the packs that ship.
Functions
standard with SubstitutionGuard bounded, for traffic whose prompts carry retrieved context.
longPrompts, reading every marker from vocabulary.
No guards: the similarity threshold decides alone.
standard for traffic that is declarative prose rather than questions.
prose, reading every marker from vocabulary.
standard plus AnswerAnchorGuard, the one guard that reads the candidate's stored answer.
responseAware, reading every marker from vocabulary.
standard with SubstitutionGuard reading three-word questions, for traffic that is mostly short.
shortQuestions, reading every marker from vocabulary.
The default set: one guard per way a near-miss slips past a similarity threshold, wired to the English GuardVocabulary.
standard, but reading every marker from vocabulary — the way to run the guards against a non-English language, or a customized marker set. NumericGuard is language-agnostic and takes no markers; every other guard is fed from the pack.
standard for an ISO 639 language code, using the shipped Vocabularies pack.
java.util.Locale conveniences for the guard vocabularies.
standard with the tolerant edges pulled in: prompts must share meaningfully more wording, and a large length gap is enough to refuse on its own.