Answering with pre-stored variables (ft. botpress ...
# 🤝help
h
Hi BotBuilders, I'm in a very desperate situation. I've been building a chatbot using Botpress for a month now, and I've been struggling for 5 days to implement a feature that gives customers an estimated quote based on their pre-answered questions(saved in variables). In the attached table(I put the data into a Botpress table.), "size" and "cycle" each have the answer stored in a variable. (These are the customer's answers) How can the chatbot tell the customer the "price" based on size and cycle? I've been trying and failing hundreds of times for days and I'm stuck. Any small ideas, clues, etc. would be great, so please help. 😭 https://cdn.discordapp.com/attachments/1244459677706752000/1244459677870456923/image.png?ex=665530e4&is=6653df64&hm=e783b4f4ac6fd540a564b24c27956c7c8ae6bed931855aef0c1cf6532f6334ff&
f
Hey there, You can use the AI Filter to find the record with the specific size and cycle and then send the price to the user. https://botpress.com/docs/cloud/studio/tables/#findrecords
h
Hi Decay and @User, I've already found the AI Filter documentation, but I'm a non-developer and don't know any coding, so I can't understand it. 😵‍💫 Can you elaborate a bit more so that even an illiterate person can understand? I have no clue what to do or how to do it, just some clues or examples of how to implement it would be very helpful.
a
Hi @happy-bird-84275 ! You can utilize the Knowledge Base lookup feature to achieve your goal. To do this, follow these steps: Convert Your Table to a Knowledge Base (

https://www.youtube.com/watch?v=rescPrnpVRc

) Use the Query KnowledgeBases agent to query your newly created knowledge base. Please find an attached screenshot demonstrating this bot https://cdn.discordapp.com/attachments/1244459677706752000/1244725745536733194/Screenshot_2024-05-27_at_2.55.02_PM.png?ex=665628af&is=6654d72f&hm=e53f1ac9dc92c726f11d19cf952fd4bbdc00afaeb3c3267e2e737baee66fbc06& https://cdn.discordapp.com/attachments/1244459677706752000/1244725745872535622/Screenshot_2024-05-27_at_2.55.31_PM.png?ex=665628af&is=6654d72f&hm=552b54b240156cb39b907f11311e6b926c782bcad14aa3ae798eb879ff74c433&
h
Hi Ermek, First, thank you for your kind response. 1. I've been experimenting a lot with the Query Knowledge Bases card and the bot kept giving me weird answers. But when I looked at the screenshot you posted, I noticed that the raw input card for the question where I store the size/cycle variable also has “Show books (Knowledge Base is enabled)”, so I enabled it and it seems to work. Do I need to enable this? 2. There's a very big problem, it doesn't seem to recognize the range properly. when size is 35, it answers correctly, but when size is 7(and other numbers, for example 8, 9, 10, etc), the bot gives a weird answer. (Query is the same as yours). I would be very grateful if you could tell me what to do. 😄 https://cdn.discordapp.com/attachments/1244459677706752000/1244767936485527683/image.png?ex=66564ffa&is=6654fe7a&hm=2e8d5be5889fb873a8d78aa14260be3a7fd8ca995ac5a8bd8a7573005134041e& https://cdn.discordapp.com/attachments/1244459677706752000/1244767936778866720/image.png?ex=66564ffa&is=6654fe7a&hm=3d0208871573b155f42635017e72d61c09c147e427ad0d1168f6f745f30d61e6&
For reference (and I don't know if this will help you answer), the table associated with the KB looks like the attached picture. https://cdn.discordapp.com/attachments/1244459677706752000/1244783155202887782/image.png?ex=66565e27&is=66550ca7&hm=f9b76d15ecd219b24054fd60676a35ef821a557956b342c543cc046781b33930&
a
Hi @happy-bird-84275 , can you please follow these instructions and provide me the problem id so I can look into it?
@square-energy-41150
s
# Sending a Problem Report Here's how to send the Botpress Team a problem report: 1. In the Botpress Cloud Studio, locate the "Help" icon in the bottom left corner of the screen. 2. Click "Report a problem" and follow the steps on the screen. 3. Copy the Report ID to your clipboard and provide it to a member of the Botpress Team on Discord.
message has been deleted
h
Hi Ermek, This is the Report ID: report_01HYZZ19FXTGWAN4K4PGTWXTST Many thanks! 🫡
a
h
@aloof-traffic-22451 1. Yes, but when size is 7(and other numbers, for example 8, 9, 10, etc), the bot gives a weird answer. Could you try some small numbers like less than 10? 2. What I really want is for it to just answer a price string (e.g. “200,000 to 280,000”). Is this possible? (I don't want it to say something like “The price range for a size~~”).
h
@aloof-traffic-22451 Yes, you are right!
It should be "200,000 ~ 280,000".
@happy-bird-84275 In your table, prices vary based on the frequency of weekly washes. Ask the user how many times a week they want their clothes washed and add this information to the knowledge base query to get an accurate quote.
h
@aloof-traffic-22451 Can you give me a little more detail? (I'm a Botpress newbie, so I'm not sure what you're asking me to do yet. It sounds like you're asking me to add another cycle, but I'm not sure what you mean).
If you don't mind, I'd love to take a closer look and follow along if you upload your bot.
@aloof-traffic-22451 Please check if I understand you correctly. In the screenshot, the Query Knowledge Bases already has the cleaning(=wash) count as a variable. <- Is this what you want me to do? https://cdn.discordapp.com/attachments/1244459677706752000/1245121830524551198/image.png?ex=66579991&is=66564811&hm=f2eb1ff36d26d393141f8bc259978373d91381ab7cb63f62105a957abf31d71a&
a
I changed the database column size to minSize and maxSize, it will make it easier to query knowledge base. Also I implemented the AI task to extract the actual price https://cdn.discordapp.com/attachments/1244459677706752000/1245122791381008404/smiling-quelea_-_2024_May_28.bpz?ex=66579a76&is=665648f6&hm=765a005f408fbf6f9b0fae733588cdad8f2a6ac31234276b0c833ee59c1055d7&
h
Oh thanks Ermek! I'll give it a shot with yout bot 🙂
a
Awesome, let me know how it goes
h
@aloof-traffic-22451 I think the bot is still hallucinating. I tested it by putting the data into a DB table (I created a new Data5Table and put the data into it) in the form you configured, but when I put size = 2, it comes out like this, but I need to get the answer of "200,000 ~ 280,000". This is report ID regarding this issue: report_01HZ0J5RW8SVS6X2CYRK1H9BKD https://cdn.discordapp.com/attachments/1244459677706752000/1245130224493133845/image.png?ex=6657a162&is=66564fe2&hm=565c227fa12dfe48164bfb046ebd300d98649c7260f997f950262c5ddd0c3ae3&
@aloof-traffic-22451 Additionally, when cycle is 7, there should always be a “Contact Us” string, but I've noticed that the conversation ends without any response. 😵‍💫 https://cdn.discordapp.com/attachments/1244459677706752000/1245133115593064549/image.png?ex=6657a414&is=66565294&hm=021e674071ac9c0ae73b09e855259b78dc50b02083be91b2e6b988c66da557c6&
a
h
@aloof-traffic-22451 Wow, finally it works BEAUTIFUUUUUUULLY~~~! Thank you so mych Ermek and you saved my day 😁 Is there any way I can donate to buy you a cup of coffee or something? I really appreciate it and want to reward you with something.
a
I'm glad it worked, @happy-bird-84275! I can't accept donations as Botpress is my full time job, but thank you 😊
h
@aloof-traffic-22451 I have one question (don't worry, everything works perfectly 👍) Looking at your work, when you put a variable in the Text card, you put [0].price after the variable name. What is this? Can you explain it to me if you don't mind? https://cdn.discordapp.com/attachments/1244459677706752000/1245493143579791451/image.png?ex=6658f361&is=6657a1e1&hm=0539aa4401f60045cd0814d47f6d513881ac1e44e2c0871125ce9f511f013cc5&
f
It's used to access the first element of an array. workflow.firstEstimate is an array so [0] access' the first object in that array and then .price is used to get the value of the price property from that object.
Also. You can always ask ChatGPT about such questions. It can explain a lot of code for you, and it will usually give you a really good and detailed answer 🙂
And it's faster!
h
@fresh-fireman-491 Oh wow, thanks a lot buddy! I'll try to get to know GPT better 😺
f
You are very welcome, and best of luck
41 Views