Finding answer in table based on variables
# 🤝help
h
Hi, I want to implement a feature that will answer a customer's question by finding the value in a table that is stored in the specific variables they answered. For example, in the previous node, the customer has already answered and provided the value '30' for variable 'A' and the value 'C1' for variable 'B'. I want to use the values stored in these two variables to extract the value(string of "200,000 ~ 280,000") in the table and show them to the customer. Note that the x-axis of the table is not a single number or string, but a range of numbers (see attached). Please give me some feedback on how I should implement this feature. Many thanks 🙂 https://cdn.discordapp.com/attachments/1241473039141568593/1241473039644753940/1_.jpg?ex=664a535e&is=664901de&hm=b2aa01fd9cc1b6e9402318191ef95815cc565a76c1b74d5c1498eb0edab73f43&
f
Hey there, You can use the table in Botpress for that. I would advise you to read through the table docs, which explains everything about the tables, with examples 🙂 https://botpress.com/docs/cloud/studio/tables/ Let me know if you get stuck
h
Hi Decay, I've already created a table using the Botpress table function. The problem is, it's not answering the value of the right cell, it's hallucinating. Q) How do I implement a node that finds the corresponding value in the table based on a variable? (I tried using the AI task, but the bot doesn't give me the right answer.) Thanks 🙂
f
Hey there, The AI Task isn't connected to the tables. You can add them as a knowledge source in your KB, and then query the KB via a query knowledge bases card. You could also use an Execute code card with an AI Filter, as explained in the docs.
h
Thank you Decay! I'll do some research based on your answers. 🙂
f
You are very welcome, and let me know if you get stuck
h
Hi Decay, I've tried to generate the code by putting a natural language query in the Execute code, but it didn't work (I tried dozens of variations). Can you please create a natural language query to get a specific value from an attachment (table) based on a variable with a number that the user entered (=answered) in the previous step?
f
Hey there, You can use find records for this. https://botpress.com/docs/cloud/studio/tables/#findrecords
32 Views