Skip to main content

Overview

The ValidateContent block validates text content against various rules like required substrings, forbidden words, length constraints, and regex patterns.

Input Parameters

Required

Note: Use the from/as input format to map your data to the text parameter.

Configuration

All config parameters are optional. Use the ones relevant to your validation:

Output Fields

Examples

Validate Required Keywords

Success:
Failure:

Forbid Inappropriate Content

Validate Text Length

Regex Pattern Matching

Combined Validations

Common Patterns

Validate AI Response Quality

Multi-Field Validation

Content Safety Check

Validation Score

The score field represents how well the content passed validation:
  • 1.0 - All validations passed
  • 0.5 - Some validations failed
  • < 0.5 - Multiple validations failed
The score is calculated based on:
  • Missing required content
  • Forbidden content found
  • Length violations
  • Pattern mismatches
Use the score for assertions:

Error Messages

Common failure messages:

Full Example

Tips

ValidateContent expects a text parameter. Use the from/as format:
The contains and notContains checks are case-insensitive:
Use ValidateContent for structural checks, LLMJudge for semantic validation:
Regex patterns are powerful for complex validation:

When to Use

Use ValidateContent when:
  • Checking for required keywords
  • Filtering inappropriate content
  • Validating text length
  • Pattern matching (emails, URLs, etc.)
  • Structural content validation
Use LLMJudge instead when:
  • Checking semantic meaning
  • Evaluating tone or style
  • Comparing similarity to expected content
  • Complex reasoning about content

Next Steps

LLMJudge

Semantic content validation

ValidateTools

Validate AI tool calls