How to Use the Query Data Block

6:20
Automation Workflows

The Query Data Source block

The Query Data Source block lets you create an explicit query within your application workflows. This allows you to pull in context from a data source and then use it in later steps of your workflows.

How to configure the Query Data Source block

Once the Query Data Source block is added to your workflow, you can configure it using the configuration panel on the right. Here is how you would configure the block for an AI application designed to help sales professionals get answers to questions related to sales best practices.

  1. Data source: Choose the data source that you will use. For this example, we are using a sales handbook that contains files with sales best practices.
  2. Variable: Use this name to store the returned results. For this example, the variable is query_result.
  3. Max results: Select the Max results to be returned. In this example, we’ve selected 3.
  4. Query template: Add your Query template. This template will be used to pull in the information you need from the data source. For this example, we’ve used the Query template: “//The constructed query for the data source. For example: “I am looking for information about [topic]!” {user_query}.” The user_query variable will be used to display the user’s query in the Query template.

Example automation workflow

Here’s what the automation workflow for this example includes:

  1. User Input: The user is asked, “What would you like to know?”
  2. Query Data Source: This block uses the user’s input (the user_query variable) and the Sales Handbook data source to construct a query.
  3. Generate Text: The result of the query (the query_result variable) is then passed to the Generate Text block to create the AI’s response.
  4. Chat: The AI then presents the final answer to the user.