Skip to main content

Function: phraseMatches()

phraseMatches(entries, text): PhraseEntry[]

Defined in: packages/agentos/src/safety/guardrails/builtin/PhraseListGuardrail.ts:152

The entries of a list that occur in a text, under the built-in normalisation and the same word boundaries the guard compiles, with no judge: a deterministic check for a caller that only needs to know whether a reviewed phrase occurs. An entry whose onMatch is judge is reported like any other; deciding what a match means is the caller's.

Parameters​

entries​

readonly PhraseEntry[]

The reviewed entries.

text​

string

The text to read.

Returns​

PhraseEntry[]

The entries that match, in list order.

Throws​

Error when an entry's phrase normalises to nothing, as the guard does.