Have Multiple Agents on a Web Server

rasa-core
rasa-nlu

(Adrian Humphrey) #1

Hello,

I have a server where I would like people to interact with a bot, however, not the same exact bot, I would like different instances of the bot. For example, it loads the same nlu model and dialogue model, however, 2 different people can have two different conversations at the same time.

How do I achieve this on a server? Can I use pickle to save an instance on Agent()? Is there a way to save the conversation? How do I go about the architecture for this?


(Bob Harris) #2

Hi Adrian - I’m currently experimenting with RASA and planning to use it behind the Alexa NLP. (Mainly planning to use RASA Core to implement our “chat” functionality via Stories as it’ll allow us to evolve them without having to re-release the Alexa Skill. May also make use of RASA NLU, or perhaps spaCy or NLTK, to do some entity recognition as it offers more than Alexa currently exposes in this area.)

Anyway as a result I’ve been experimenting with both the RASA Agent and the RASA HTTP Server while I decide on my overall Solution Architecture. In both cases I’ve been able to hold multiple, concurrent, independent conversations using a single instance of the Agent or the Server by setting the Sender-Id field to assign inputs to a specific conversation. Seems to work OK, but I haven’t tested exhaustively yet.

I still have investigate the scalability of each approach, as in what limits the number of parallel, in-flight, conversations I can hold (probably memory?), and how to persist/restore conversations across User visits (to help manage memory).

Finally need to decide between HTTP Server where I’ll probably call it via AWS API Gateway, or writing my own Agent capable of handling multiple clients which, again, I’ll probably put behind API-GW. Overall, I’m erring toward the latter as I like the Agent functionality, but it could go either way.

BobH


(Adrian Humphrey) #3

Thank you for this response. Regarding the Agent HTTP and passing in different ID’s, does the Rasa AGent take care of the different conversations for you? Or do you need to do a check on the Id and start a different concurrent conversation?


(Adrian Humphrey) #4

Hello, your answer was my solution!! Did not even know the agent came with that functionality. Thank you so much!


(Shruti) #5

Hi Bob, Adrian,

I am new to the Rasa community and looking to create something similar to what Bob has created. I want to create a custom chat bot at the backend of Alexa skill. I have worked on Alexa skills before but the problem I have faced is that to carry out a conversation with Alexa (without invoking her name each time) is to be in “multi-turn” environment which is a specific ASK code snippet. If I don’t use it, Alexa shuts down the intent after a single reply. I would like to seek your help/guidance to understand how you worked around this problem? That is how to you connect your Rasa chatbot and Alexa so that it can have a fluid conversation? If possible, could you please show some code snippet for this part Any information/help is greatly appreciated.

Thank you, Sandy


(Adrian Humphrey) #6

I am still working on it, but I will keep you updated. The method is to create your own server like above and get responses from your own custom bot and create your own custom logic with Amazon.


(Shruti) #7

Thanks adrian. I was able to establish connection between alexa and the chat bot. I have the most basic version of the bot. My current problem is that if it can’t find an intent or I say some intents in wrong order, the bot output is empty. Do you know I can always make it return a non-empty output- something like- “Sorry I didn;t get you”

Thank you, Shruti


(Adrian Humphrey) #8

Het Sandi,

Yes you can, you can set up fallback actions covered here https://rasa.com/docs/core/fallbacks/. This way you set a certain threshold for confidence, and it is below a certain confidence, and if it below then you can set up a certain action to always run.

I would warn you, the less training data you have for the dialogue, the more the bot will return nothing. For example if your stories.md contains stories with only 3 or 4 intents and actions and you try to have a conversation beyond that, the bot will not be able to correctly handle it. You must provide enough training data.

Another tip, it to use the MemoizationPolicy along with your current policy. What this does, is during training, the bot will memorize your training examples as well as set up featurizations for predictions.


(Shruti) #9

Thanks Adrian for this comprehensive answer!! Will let you know how it goes…

Regards, Shruti