Same question, different answers
# 🤝help
w
Hi guys can someone help me with this? I sent my bot the same question twice. The first time, It didn't find the answer in the KB and sent me the message for not finding the answer, that is the one with the emoji. Then, I just sent again the same question and it found it and answered me. Has this ever happened to anyone else? https://cdn.discordapp.com/attachments/1228061724087947334/1228061724356247654/image.png?ex=662aac9b&is=6618379b&hm=90ae34f4498430c50c1ec9665ceb800cf83e751df65abe6b871bc1673dc233b8&
f
Hey there, It seems a bit weird. Can you send us a screenshot of your workflow here, where you highlight the part where it messed up
w
Okay
this is the part of the workflow. Nothing wrong happened to the workflow. It just didnt found the answer for my question. https://cdn.discordapp.com/attachments/1228061724087947334/1228071405741019206/image.png?ex=662ab59f&is=6618409f&hm=0f9e8724a2746ab018e8ae214ba4a87fcce5003cb9267c6de1446a136225a0d3&
f
That's the thing. It should have found an answer. Can you reproduce this error?
w
Okay, I'll try. But Its kinda unstable So I don't know if I'll be able to reproduce it
f
I think it might be a wrongful transition because of the expression cards, but I am just guessing.
just did it
f
Does it also happen when you are using it from the emulator?
Or is that where you are testing it from?
w
ill check the logs but the expression cards just set boolean values to variables. The validQuestion task check for curse words and is set true or false the other one is to check if the user typed "return"
its happening in the bot implemented in the website of the company I work for
Ill test it on the emulator
same on the emulator
nothing on the logs
f
Can you see if it found an answer in the logs? Or if it didn't. Feel free to include a screenshot of the logs
w
In the first interaction it didnt find a answer and on the second one it did
I will try to reproduce it again to screenshot the logs
f
Sounds good
w
Ok, I've tried with the same question a couple of times and it answered me correctly on first try
I think it was just a instability
Its working normally now
f
That sounds weird, but nice to hear that its working
w
I think it happens when I add a new thing to the KB. For some time, it just responds on the second try. And maybe after, it returns to normal
f
I haven't seen anyone else with this issue, so I don't think its Botpress related. Can you export your bot here. Make sure to delete all private information
Then I can take a look at it tomorrow
w
OK
you might find a lot of set user language around. It was me tryng to make it stop changing languages mid text
f
Just looking at your bot now. I am not really sure why you have these expression cards. You shoulod use an execute code card for the last one:
if workflow.validQuestion is false, than set bot.bad_words = true
You are not storing the response from the AI Task anywhere, you should probably do that https://cdn.discordapp.com/attachments/1228061724087947334/1228448370335682571/image.png?ex=662c14b2&is=66199fb2&hm=f99a69895f92c43c379abe34497beb9f17dbd31e5808a94997908fc06080d4fe&
I think that you might have overcomplicated some things for your self, and that you might also be using the wrong cards for the wrong tasks 🙂 I don't understand portugese, which doesn't make it easier for me to understand the workflow and what is going on / what should be going on. I can leave you with some tips though. If you want to transition to a node when the Knowledge Agent didn't find an answer you can use an expression card with the expression
!turn.KnowledgeAgent.answer
and if you want to transtition to a node if it found an answer you can use
turn.KnowledgeAgent.answer
Reading the docs and watching the Botpress YouTube tutorials and livestreams and checking out other people bots like in #1120796649686573086 will also help a ton in understanding what to use for each objective.
w
choosePhrase is a function that ive created on the variable bot.utils. This function chooses a different phrase from a table and store it in a variable, and then is sent to the user in the workflow
Which expression cards are you talking about?
Ah okay cool
w
The first one is If the user typed "return" The third one is if the question is invalid And the second one is if the question is valid, but actually its purpose is to make two medium nodes instead of a big one I could put it all together, but i don't think its necessary. It would make my bot better?
Instead of using two different nodes, one for found an answer and other one for not founding, I'm just changing the variables bot.not_found and bot.bad_words to true, and that changes the answer that the bot gives to the user Is this bad pratices?
Take a look at the PhrasesVariantesTable. It will help you undestand the function. It takes all the phrases with the type "bad_words" and sorts one of them. Also, taking a look at the Hook called SetupUtils will help
f
Thank you for clarifying that. I am not sure if I would call it bad practice, but its build a bit differently compared to how I would usually go about it. I think you have overcomplicated it a bit, but I of course don't understand everything about you bot. I got some ideas, would you be okay with me recording a little video and sharing them / showing you them there, or would you rather have me write them down?
w
Oh, ok! I guess either writing or recording would be ok
I guess its better to write because we are brazilian So the video could be harder to undestand
f
Fair enough 🙂
I would restructure your "hierarchy" of your nodes a bit.
Right now lets the user ask a question, and then it answers that question instantly. After answering it it checks if it contained a bad word.
It would then query the KB if it doesn't contain a bad word. It would then check if it found an answer from the KB, and it would then send this answer, if it found one
This was just for inspiration, and I am honestly not sure if it would work for your bot, or with your idea of how it should be 🙂
w
I saw that you used "Query knowledge bases". Does this affects the perfomance of the querys, and the answer? Is it better to use it?
I liked your naming a lot I'll change the names to better describe the cards of my bot
And, I saw that you didn't use the code execution to choose a different phrase from the table each time it falls into the node. Why? Does it improve perfomance? Or is it just an architecture thing?
f
Its just so that it doesn't query the KB before we have determined if a bad word was used. Its pretty much the same as the as any other card that queries the KB. You can customize the query, but that is also it.
I left some things out because I wasn't sure of what they did
I thought its job was just the same as the AI Task.
w
Ohh, ok then Thats clever I'll refactor it
Actually, the code card Execute the functions to choose ramdom phrases from the table that contain different pharses that say the same thing. To enhace the experience of the user In case it founds a bad word, it chooses an answer from the bad word section
f
Why do you need that?
w
The function? To choose diferent phrases from the table
f
The phrases
w
To have different interactions with the user. To interact with a different phrase each time.
I could use personality agent for that But agents increase time of response, and for me its not reliable, since it changes a lot the sentences and the subject sometimes, not being as specific as i want it to be
f
Ah smart!
2 Views