Skip to content

Amazon bedrock's flow builder: conditional node always defaulting to false?

0

Hi,

I'm trying to get the conditional node to return true so I can access my knowledgebase. However, it's constantly defaulting to false, even though I'm following the instructions exactly as laid out here: https://www.youtube.com/watch?v=_Bmk6peAHao


The user prompt is: List my transactions from August 2024.

*Here's my Classification Prompt * Categorize the user input into of one of this: If the user is asking a question about their transactions, then category is 'transactions". If the user is asking about anything else, then category is 'generic'. Answer only with the category. Userinput: {{input}}

Once it gets to the condition node, it is: conditionInput == "transactions"

Then I run the command.

However, when looking at the trace: Input trace { "fields": [ { "content": { "document": "\n\ntransactions" }, "nodeInputName": "conditionInput" } ], "nodeName": "ConditionNode_1", "timestamp": "2024-11-22T22:08:41.584Z" }

"Condition trace" { "nodeName": "ConditionNode_1", "satisfiedConditions": [ { "conditionName": "default" } ], "timestamp": "2024-11-22T22:08:41.585Z" }

As you can see, it's always going to false, ie "default"

Is this a bug or am I doing something wrong?

asked 2 years ago460 views

2 Answers
2
Accepted Answer

From your trace, it looks like the input to the condition node is coming as "\n\ntransactions" (check the . two new line chars \n\n) which is causing the condition to fail. Please check the prompt node in the flow. The LLM response could cause this type of inconsistencies.

While replicating the issue, with the claude3 Haiku (as in the video), the prompt node's output is correctly and precisely classified as "transactions" (no new line chars) and the condition went to the right one. Whereas when I switched to Llama 3 8B model, the prompt node's output came as "\n\ntransactions" and went it hit the default condition.

Try changing the LLM, which is most likely the cause of the issue in your case.

AWS

answered 2 years ago

EXPERT

reviewed 2 years ago

0

Thank you, this worked! Seemed as the model wasn't giving me the right result.

answered 2 years ago

  • Stay tuned. Flows is still a newer feature. More and more conditional evaluations will come, so you could use the same Llama3 model and do a contains() operation to match a string etc. Meanwhile you can look at latest Llama 3.2 models like 1B size which do return the classification response in expected format.

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.