Add `sender_id` argument shell and interactive command line tools
See original GitHub issueDescription of Problem:
Both rasa shell
and rasa interactive
do not support the ability to set the sender_id
field. Instead for shell, the sender_id
is just set to the default value of default
, where as for interactive, the field is set to a uuid. To test stories/run interactive learning with custom actions that rely on the sender_id
field value, the current tools lack the ability to customize this field.
Overview of the Solution:
A straightforward solution would be to add a --sender_id
command line argument to rasa shell
and rasa interactive
. This argument would then be passed to the respective record_messages
function, which already supports the sender_id
parameter.
Furthermore, the default value for this argument should not change the functionality of the current implementation (shell defaults to default
and interactive defaults to a uuid).
Examples (if relevant):
An example of a custom action that would rely on the value of the sender_id
is as follows.
import logging
from rasa_sdk import Action
logger = logging.getLogger(__name__)
class ActionLogSenderId(Action):
def name(self):
return "action_log_sender_id"
def run(self, dispatcher, tracker, domain):
logger.info("Sender id: {}".format(tracker.sender_id))
Currently, when running rasa shell
, the logged value would be Sender id: default
, whereas when running rasa interactive
, the logged value would be Sender id: {some random uuid.uuid4().hex}
.
With the proposed change, when the user runs rasa shell --sender_id unique123
or rasa interactive --sender_id unique123
, the logged value would be Sender id: unique123
Blockers (if relevant):
None
Definition of Done:
- Tests are implemented for shell and interactive.
- The
--sender_id
argument is implemented and meets tests. - The
--sender_id
argument is added to the Command Line Interface docs for both shell and interactive.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:22 (16 by maintainers)
Top GitHub Comments
Not having the ability to set the sender_id at run time has also caused a lot of headache for our team. Our Rasa actions interact with many different REST services. Many of those services require a valid user id (sender_id) in order to get a successful response. Furthermore, we expect different responses depending on the region that the user is in or preferences they may have set. It’s impossible to test these cases without being able to change the sender_id on the go.
For example, if someone asks a bot, “when is the next holiday?” we would expect a different response for a user in Germany versus a user in the United States. The only way to test that these cases are working properly during interactive training is to change the sender_id to one associated with a user in the various countries.
The
rasa interactive
part is done now (#5243)