Chat bot is handling only 1 request at a time, How will multiple users use chat bot at a time? User can’t wait for the chat bot server to be free. Chat bot should use parallel execution concept.
How can i implement parallel execution concept in rasa action server for multiple users?
Parallel execution is defined in the Rasa server agent by default. You can test this out by running your Rasa instance in server mode (rasa run) and using a REST client such as Postman to send it messages as JSON objects, like so:
{
"sender": "Sender",
"message": "Hello"
}
Try changing “sender” to different values and holding multiple conversations with your bot.
@ActuallyAcey, Can you please explain it, how can we send sender id with conversation?
and i’m talking about parallel execution with rasa action server?
And i’m using rasa bot(web component) which uses regular HTTP requests.
How you send a sender ID depends entirely on your choice of frontend. End of the day, the RASA server wants a “sender” field in the JSON that you send to it. The sender can be any unique but persistent value that you can assign to someone.
For example, if your chatbot shows up after a login page, you can send the login ID as the sender. If not, you can send a randomly generated number.
@ActuallyAcey Thanks for your response,
I tried with sender id, but its not working for parallel execution of rasa action server(rasa run actions -p 5055).
basically the action server is only called “server” when used by sanic/flask. The code which actually executes a RemoteAction resides in /rasa/core/actions/action.py. You could do something like the following to achieve what you want:
Keep in mind that you have to insert the path for the actions.py you want to use inside the PATH variable and that this approach means modifying the rasa core. I am not sure why you want to do what you mentioned, but this possibly helps you.
Hi, @rsawriya my code looks something like this for testing out the bot on server. To simulate users, you could make functions with different names or just this one function iterating over a list of users.
Albeit, testing with RasaX is convenient if you aren’t looking for an approach which is developer/coder friendly. Hope I could be of help
def func1():
timer = []
sender = "user1"
words = ['hi', 'i am good', 'sad']
description = {}
c = 0
while c != 15:
message = random.choice(words)
start = time.time()
requests.post('http://localhost:5002/webhooks/rest/webhook', json={"message": message, "sender": sender})
end = time.time()
timer.append((end - start))
description[(end - start), c] = message
c = c + 1
if c == 15:
break
count = [i + 1 for i in range(len(timer))]
plt.plot(count, timer)
plt.xlabel('iteration')
plt.ylabel('time')
plt.show()
print(description)
print("1 finish")