Actions - call external Ai model and get session persistent response

Consider i have a Pytorch hosted on external service via API. I can call it from my custom action, send user message and get answer from model - it is dialog conversation model with context.

This API doesn’t support user sessions. Now if I send request(start conversation) from 1 browser and in parallel in another browser - the model response to BOTH users like it has only one dialog. That means 2nd user can get a part of dialog of first user, what is bad behavior.

Question: if i use Rasa and will send requests from different user using actions server will Rasa support and separate user session from external Ai model ?
I know this supported in core for simple nlu trained with core model, but will this work with external model? Asking before realization @akelad

Hey @BitcoinKing, as for session handling with this external service: I can’t give you advice on that, because I don’t know what this model does/how it’s implemented.

Rasa Open Source (and it’s in-built dialogue management system) will, however, maintain user sessions.


I think you can add sender_id from tracker.get("sender_id") into whatever you send into your external model from your custom action code. Then, you need to make the context different for each sender_id inside your Pytorch model. That way, you can persist same context from inside Rasa and your external model.