Dynamiq Docs
  • Welcome to Dynamiq
  • Low-Code Builder
    • Extractors and Transformers
    • Chat
    • Basics
    • Connecting Nodes
    • Conditional Nodes and Multiple Outputs
    • Input and Output Transformers
    • Error Handling and Retries
    • LLM Nodes
    • Validator Nodes
    • RAG Nodes
      • Indexing Workflow
        • Pre-processing Nodes
        • Document Splitting
        • Document Embedders
        • Document Writers
      • Inference RAG workflow
        • Text embedders
        • Document retrievers
          • Complex retrievers
        • LLM Answer Generators
    • LLM Agents
      • Basics
      • Guide to Implementing LLM Agents: ReAct and Simple Agents
      • Guide to Agent Orchestration: Linear and Adaptive Orchestrators
      • Guide to Advanced Agent Orchestration: Graph Orchestrator
    • Audio and voice
    • Tools and External Integrations
    • Python Code in Workflows
    • Memory
    • Guardrails
  • Deployments
    • Workflows
      • Tracing Workflow Execution
    • LLMs
      • Fine-tuned Adapters
      • Supported Models
    • Vector Databases
  • Prompts
    • Prompt Playground
  • Connections
  • LLM Fine-tuning
    • Basics
    • Using Adapters
    • Preparing Data
    • Supported Models
    • Parameters Guide
  • Knowledge Bases
  • Evaluations
    • Metrics
      • LLM-as-a-Judge
      • Predefined metrics
        • Faithfulness
        • Context Precision
        • Context Recall
        • Factual Correctness
        • Answer Correctness
      • Python Code Metrics
    • Datasets
    • Evaluation Runs
    • Examples
      • Build Accurate vs. Inaccurate Workflows
  • Examples
    • Building a Search Assistant
      • Approach 1: Single Agent with a Defined Role
      • Approach 2: Adaptive Orchestrator with Multiple Agents
      • Approach 3: Custom Logic Pipeline with a Straightforward Workflow
    • Building a Code Assistant
  • Platform Settings
    • Access Keys
    • Organizations
    • Settings
    • Billing
  • On-premise Deployment
    • AWS
    • IBM
    • Red Hat OpenShift
  • Support Center
Powered by GitBook
On this page
  • Overview
  • Key Features
  • Available Validators
  • Configuration Options
  • Response Format
  • Best Practices
  • Common Use Cases
  • Troubleshooting
  1. Low-Code Builder

Validator Nodes

PreviousLLM NodesNextRAG Nodes

Last updated 7 months ago

Overview

Validator nodes are essential components within Dynamiq's platform that perform data validation within your workflows. These nodes act as quality control checkpoints, ensuring that data meets specific criteria before proceeding through the workflow.

Key Features

  • Flexible validation rules

  • Configurable error handling behavior

  • Support for multiple data formats

  • Built-in error messaging

Available Validators

1. Valid Python (ValidPython)

Validates that the input content follows the correct Python syntax.

Example Usage:

{
    "content": "def hello_world():\n    print('Hello, World!')"
}

2. Valid JSON (ValidJSON)

Ensures input content is properly formatted JSON. Handles both string and dictionary inputs.

Example Usage:

{
    "content": {"name": "John", "age": 30}
}

3. Valid Choices (ValidChoices)

Verifies that the input content matches one of the predefined acceptable values.

Example Configuration:

{
    "choices": ["option1", "option2", "option3"],
    "content": "option1"
}

4. Regex Match (RegexMatch)

Validates the input content against a specified regular expression pattern.

Match Types:

  • fullmatch: Entire string must match the pattern

  • search: Pattern can match anywhere in the string

Example Configuration:

{
    "regex": "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}$",
    "match_type": "fullmatch",
    "content": "user@example.com"
}

Configuration Options

General Settings

Each validator node shares these common configuration options:

Setting
Description
Options

Name

Node identifier in the workflow

Text input

Behavior

Action on validation failure

RAISE, RETURN

Validator-Specific Settings

Valid Choices

  • Choices: List of acceptable values

  • Strip whitespace: Automatically applied to string inputs

Regex Match

  • Regex: Regular expression pattern

  • Match_type: FULL_MATCH or SEARCH

Response Format

When behavior is set to RETURN, validators output:

{
    "valid": bool,  # Validation result
    "content": Any  # Original input content
}

When behavior is set to RAISE, validators:

  • Return the input content if validation passes

  • Raise a ValueError with detailed error message if validation fails

Best Practices

  1. Error Handling

    • Use RAISE behavior for critical validation points

    • Use RETURN behavior when you need to handle invalid data gracefully

  2. Input Sanitization

    • Consider using RegexMatch for input sanitization

    • Valid Choices for enforcing controlled vocabularies

  3. Performance

    • Place validators early in workflows to fail fast

    • Use appropriate match types in RegexMatch to optimize performance

Common Use Cases

  1. Form Validation

{
    "type": "RegexMatch",
    "regex": "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}$",
    "behavior": "RAISE"
}
  1. Configuration Validation

{
    "type": "ValidJSON",
    "behavior": "RETURN"
}
  1. Code Quality Checks

{
    "type": "ValidPython",
    "behavior": "RAISE"
}

Troubleshooting

Common validation errors and solutions:

Error
Possible Cause
Solution

"Value is not valid JSON"

Malformed JSON string

Check JSON syntax and structure

"Value is not in valid choices"

Input not in choices list

Verify input against allowed values

"Value does not match pattern"

Regex pattern mismatch

Test pattern with regex debugger

"Value is not valid python code"

Python syntax error

Check code formatting

Validator nodes in Dynamiq
Available validators on Dynamiq