Skip to content
FacebookYouTubeX (Twitter)

Using Buttons in an AI Workflow to Trigger the Knowledge Base

Use buttons to trigger Knowledge Base queries in Pingstreams flows.

Button Workflow

In this tutorial, you will learn how to use buttons in an AI flow such that the button’s title text passes through as values for the next block to be triggered. We will achieve this by assigning the button’s text as a value corresponding to its title and a key that corresponds to the lastUserText attribute. This attribute is then used to trigger a knowledge base lookup using the Ask Knowledge Base action in the subsequent block.

  1. Ensure you have uploaded a Knowledge Base (URLs, text files, Sitemap) in the Knowledge Base section.
  2. Design the initial block where the user will interact with buttons. Each button will represent a query or option that will trigger a specific response. You can include these buttons in your Welcome Block, where you can offer some FAQ examples.

2. Capture Button Text and Assign to lastUserText

Section titled “2. Capture Button Text and Assign to lastUserText”
  1. Make sure that each button is connected to a block first by choosing the button type: go to block >> choose the respective block.
  2. Then click on the ‘Attributes’ section below and insert:
    • lastUserText as the Key
    • The button’s title as the Value

This way, the AI Agent captures the button’s text and assigns it to the lastUserText attribute.

Button Configuration

3. Configure the Knowledge Base Lookup Block

Section titled “3. Configure the Knowledge Base Lookup Block”
  1. Create a new block that will handle the knowledge base lookup based on the lastUserText value.
  2. Use the Ask Knowledge Base action to query the knowledge base.
  3. Then add the text reply with the classic kb_reply that will allow the agent to stamp the answer.

Knowledge Base Block Configuration

Test the complete flow by interacting with the buttons and ensuring the appropriate knowledge base lookup and response is triggered.

By following this tutorial, you have successfully created an AI Agent flow where button interactions trigger specific Blocks based on the button’s title text. This text is passed through using the lastUserText attribute and is utilized to query a knowledge base, providing users with relevant information based on their selections. This approach enhances user interaction by providing dynamic and contextually relevant responses.

Flow Example