Unable to change the RASA Collecting Dispatcher code

Hi, I am using the following versions.

rasa-core==0.14.3 rasa-core-sdk==0.14.0 rasa-nlu==0.15.0

My requirement is to change the internal CollectingDispatcher code. Inside it, I want to change the utter_template method to the following code:

def utter_template(self,
                       template,  # type: Text
                       tracker,  # type: Tracker
                       silent_fail=False,  # type: bool
                       from_phone=None,
                       **kwargs  # type: Any
                       ):
        # type: (...) -> None
        """"Send a message to the client based on a template."""

        if from_phone == 'desktop':
            message = {"template": template + '_d'}
        else:
            message = {"template": template}
        
        message.update(kwargs)
        self.messages.append(message)

The above code will call the template with name ending with _d if the from_phone attribute is desktop. I have changed the code.Changed the file as follows and ran it.

changed the code from:

dispatcher.utter_template("utter_greet", tracker)

to:

dispatcher.utter_template("utter_greet", tracker, from_phone=from_phone)

In my domain file,

utter_greet is “Hi user”

utter_greet_d is “Hi desktop user”

But still I am getting the regular template itself.

My changes to the rasa_core package are not effecting anything. I am using virtual environment.

Please let me know where I went wrong.

how did you install rasa_core?

I have installed rasa_core thorugh pip.

pip install rasa-core

then the version that is used when you run your program is not the one where you changed the source code. You need to install from git, see installation docs for details: Installation

Okay.Can I use the packages I installed from git in production.Do they create any issues as they are still in development and how to install the specific version of 0.14.3 or 0.14.5.

Also how is the code that I installed from pip is not running and some other one is running? Just want to know out of curiosity.

I don’t think you can install old versions from git. But you can safely use 1.3.x branch in production

please take a look at pip documentation on how it is working

I have installed the git version of Rasa 1.3.X.

I have followed the instructions as per documentation and done the following.

pip install requirements.txt

pip install -e . ( Can you tell me what this will do.googled it but couldn’t find it.)

After that created a new project, with stories, custom action.

Now I want to change the collectingDispatcher code. In the downloaded files, I couldn’t find the executor.py where collectingDispatcher will be there. In fact Rasa_sdk is not their in the files.

I am clueless what to do…can anyone help me out please.

it is here: rasa-sdk/executor.py at master · RasaHQ/rasa-sdk · GitHub, so it should be in your files if you cloned the correct repo