Skip to content

Amazon Bedrock Flow (Flow Builder) - Lex Node

0

I am developing a Bedrock flow with Lexnode. I have created and tested a separate chatbot connected to the bedrock knowledge base. It is working fine. Now I wanted to use the Lexnode as part of the flow but I am not sure how to set the "requestattributes" and "Sessionattributes" (via drag and drop) in the flow builder. Any help is appreciated. Thanks

2 Answers
1

When using a Lex node in an Amazon Bedrock flow, you can configure the "requestAttributes" and "sessionAttributes" as inputs to the node. Here's how you can set these up in the Flow Builder:

  1. In the Lex node configuration, you'll need to specify the Amazon Resource Name (ARN) of the alias of the bot you want to use, as well as the locale.

  2. For the inputs, you'll see three main options:

    • inputText: This is where you'll provide the utterance or user input to be processed by the Lex bot.
    • requestAttributes: This is an object type input where you can pass request-specific attributes.
    • sessionAttributes: This is also an object type input for session-specific attributes.

To set up these inputs via drag and drop in the Flow Builder:

  1. Create input nodes or use outputs from previous nodes that will provide the necessary data for requestAttributes and sessionAttributes.

  2. Connect these nodes to the Lex node's corresponding input circles (on the left side of the node).

  3. In the Lex node configuration, you'll need to use expressions to map these inputs correctly. For example:

    • For requestAttributes, you might use an expression like: ${previousNode.requestAttributesOutput}
    • For sessionAttributes, you could use: ${anotherNode.sessionAttributesOutput}

Remember that both requestAttributes and sessionAttributes are of type "Object", so ensure that the data you're passing matches this type.

The Lex node will process the input using your configured Lex bot and return the identified intent as the output, which you can then use in subsequent nodes in your flow.

Keep in mind that while you can use the Lex node to interact with your chatbot within the flow, the flow itself doesn't support multi-turn interactions. If your Lex bot requires multiple turns to complete a conversation, you'll need to handle that outside of a single flow execution, possibly by chaining multiple flows or managing the conversation state at the application level.
Sources
Node types in flow - Amazon Bedrock
LexFlowNodeConfiguration - Amazon Bedrock
FlowNodeConfiguration - Amazon Bedrock

answered 2 years ago

EXPERT

reviewed 2 years ago

0

The question is: How do I pass these two variables? Since it is a flow from one node to another, from which node I can pass the request and Session attribute

****In the Lex node configuration, you'll need to use expressions to map these inputs correctly. For example:

For requestAttributes, you might use an expression like: ${previousNode.requestAttributesOutput} For sessionAttributes, you could use: ${anotherNode.sessionAttributesOutput}****

In the below pictures, I can pass on the input but the remaining 2 attributes are the question.

Thanks in advance

Enter image description here

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.