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
  • Conditional Nodes
  • Connecting Nodes According to Specified Conditions
  • Creating Branches
  • Workflow Execution
  • Map Node
  • Configuration
  • Input Structure
  1. Low-Code Builder

Conditional Nodes and Multiple Outputs

PreviousConnecting NodesNextInput and Output Transformers

Last updated 10 days ago

Conditional Nodes

Within the workflow, there is often a need to make decisions about whether to proceed with one branch or another. These decisions can be made dynamically during the pipeline's execution. To support this, a specialized Choice Node is used. This node allows us to set conditions based on the parameters of previous nodes, helping to determine the next step in the sequence.

In this case, the Choice Node determines which Agent will be executed next. simple-agent will be executed if the choice_is_correct_date condition is met, while simple-agent-2 will be executed if the choice_is_correct_next_date condition is met.

Connecting Nodes According to Specified Conditions

To ensure that nodes execute when a condition is met, they must be connected using the appropriate condition parameters. Note the difference between connecting the nodes themselves and connecting their parameters.

Creating Branches

In this example, we have three conditions:

  1. choice_is_correct_date

  2. choice_is_correct_next_date

  3. default

The first two conditions are manually created (see below), while the default condition is pre-defined and is met in all cases. The default condition serves as a valuable fallback mechanism when none of the custom conditions are met.

To create new condition, click on the Choice node to access its configuration. Here we can see all previously created conditions. We can either edit existing conditions or create new a branch by clicking Add branch.

To configure a branch/condition we have to specify:

  • Operator - Defines the operation we will use for the condition.

  • Value Type - Defines the type of value. This can be a string, integer, or boolean, and either a constant or another variable.

  • Value - If the Value Type is a constant, we provide the specific value. If it is a variable, we must define the method for accessing it.

We can also configure more complex conditions using the AND and OR operators.

By clicking the Add dropdown, we can continue adding additional AND or OR statements, allowing us to create conditions of any complexity.

Workflow Execution

Workflow execution in different scenarios:

Scenarios
Actions

Multiple conditions (one or more)

If multiple conditions are met, only the first one will proceed, functioning like an if-elif-else structure.

Neither condition

If no conditions are met after the Choice Node and the default condition is not connected, the workflow will exit.

Map Node

Within the workflow, It`s often necessary to repeat certain logic for various sets of data. To support this logic, the Map node is used. This node allows you to call a predefined node with specific parameters several times, depending on the amount of data it receives as input.

In this example Map node used to create text embedding for multiple text sets.

Configuration

  • Name: Customizable name for identifying this node.

  • Node: Internal node, that will be called for each set of data. Node parameters can be configured immediately after selection.

  • Behavior: Specifies the action in case of an internal node failure, with options:

    • raise: Raise a ValueError with detailed error message about fail reasons

    • return: Return output of all iteration results, specifying the failed one with detailed error message.

Input Structure

Map node accepts list of dict, each structured as single input for internal node with proper keys. For example we selected OpenAITextEmbedder, so the input structure will look like this:

{  
    "input": [{"query":"Text example number 1"},{"query":"Text example number 1"},
                {"query":"Text example number 1"}]
}

Variable - The variable we will use for the condition. The syntax follows the same format as the .

InputTransformers and OutputTransformers
Using the Choice node
Configuring the Choice node
Configuring a brach
Example of using AND logic
Workflow with MAP node