I tried to create a basic bot using Rasa. With the help of Rasa Community members I was able to do it. But Bot is throwing error only when it executes Action file for the 1st time. But all subsequent conversations work fine.
Conversation flow:
Usual Greet
User Enters Crop and Disease
Bot pulls the remedy from sqlite (thru action) and utter it as message
If user enters only disease name, then Bot asks for crop and then pulls the info
If user enters only crop name, then Bot asks for disease and then pulls the info
What happens is, I get an error when the Bot executes action file for the first time.
From the action log, it looks like it is trying to pull the data from sqlite even though it got only disease name from user (crop is still None). But as per Actions file coding, that is not supposed to happen.
The part where sqlite is queried should occur only when both crop and disease is not None. This logic is working fine in subsequent instances. But getting error when I start the conversation for first time. Please advise.
@rsklearner Hello, are you using some python file pull_remedy.py or class?
Please remove the . infront of from pull_remedy import remedysql OR share the related files if this not work. OR if its relative path then fine
@rsklearner Further, two more issue in the pull_remedy.py file on line 8 please check the syntax of remedy = mycursor.execute(sql) or what is the code for mycursor.
check the line 79 disease_name is this a column or attribute exist in the database? I really dont know your database schema, so just guessing. Sorry!
By taking your code there as reference, please put print(sql, remedy) before the return to debug a bit and check if all works as expected or not.
Also I thinkfetchone() will fetch a new row each time, not sure how much it affects the process here - This is more SQL than Rasa. Try using fetchall() instead. You’re doing [0] later anyway.
I get the values for “Crop” and “Disease” from User. So as per previous screenshot, the user inputs “wilt” (disease name alone) and at this point there is no value for slot - “Crop” i.e., None. But the control still goes to the logic in Actions file, where we hit the sql db [only when both disease and crop are not None].
This error is occurring only the 1st time when I give only the disease or crop and not both. But this error is not occurring in subsequent conversations. All future conversations work fine even if I give only disease name or crop name or combination of both.