https://discord.gg/botpress logo
Query table with autonomous node
# 🤝help
b
Can I get the LLM to query a table to match a user ID, and if it finds a match then proceed to a conversation, from within the autonomous node? And capture the user ID in a variable so that I can match the conversation to that user later. This is not for a commercial product as it is a school setting. Or would it be best to use extra steps in the workflow? And if so, what's the best logic to follow? I've got limited coding background, so low or no-code solutions are quickest for me to implement! Any help greatly appreciated.
l
p
You can use the query knowledge base card in a standard node with the instructions provided above and the output variable set to something like user.userId. That node can lead to whatever else you wanted your bot to accomplish. Hope this helps!
b
Thanks Leanne I'll give this a go - thank you so much!
p
No problem, Happy to help!
b
@User So, I ended up using the autonomous node with the instructions -" * At the beginning of the conversation, always ask the user for their exam number. Then check UsersTable in the knowledge base for that exam number. If the exam number is valid get their name from the matching row and proceed with the conversation. If the exam number is invalid ask the user to give you a valid number. Do not proceed until you are given a valid exam number." And set my table of user IDs to be part of the knowledge base. That triggered a conversation like this, which is the sort of behavior I'm after for this prototype - see image. https://cdn.discordapp.com/attachments/1370325291678957589/1371773727192121414/image.png?ex=68245b56&is=682309d6&hm=00e67d0a71b99bb85d347841ba2494d369bb9a1c5c6c0d16929a6b771a39c672&
p
I'm glad you found a method that works for your use case!