Skip to content

bmel:contains-any

Category: String · Returns: bmel:boolean

Signature
bmel:contains-any(text: bmel:string, patterns: bmel:array)

Description

Returns true if the text contains at least one string from the provided array. Case-insensitive by default. Useful for detecting hallucination markers, toxicity patterns, PII keywords, or known failure signatures in LLM outputs without requiring a full embedding-based classifier.

Arguments

Parameter Type Required Description
text bmel:string The text to search within.
patterns bmel:array Array of strings to search for. Returns true on the first match found.

Examples

Refusal markers in the answer, from a list sent with the request
bmel:contains-any({invokeAgent:Response Payload}.$.output_text, {invokeAgent:Request Payload}.$.metadata.refusal_markers)
Blocked phrases in the prompt
bmel:contains-any({invokeAgent:Request Payload}.$.prompt, {invokeAgent:Request Payload}.$.policy.blocked_phrases)

← Back to BMEL Reference