I’m also in the process of writing a custom tracker. Here are the steps I’ve gone thru:
Copy the existing rasa tracker_store.py which is in github here.
Let’s call the new file myTracker.py and place in the project root directory. Edit your copy of the standard tracker_store. Remove all of the class definitions except one that you’ll model your tracker after (I’m using the MongoTrackerStore as my template). You’ll have to add in a reference to the TrackerStore by inserting this at the top of your file: from rasa_core.tracker_store import TrackerStore
Hack away on your copy of the MongoTracerStore, let’s say you’ve called your copy of the class MyTrackerStore.
Throw a logger message at the beginning of your init function so you know that it’s been invoked when the Core starts.
Based on the settings above, the endpoints.yml entry will look like this:
I have my custom tracker store working and realized there I forgot to mention the requirement of the url parameter as stated in the docs. If you’re copying the existing MongoTrackerStore as your template, you must add a url parameter to the class __init__ call.
Is your example maybe available? it could be useful (for not python programmers like me) to have a shared example of a custom tracker store. My proposal is a FileStore just to store “chat history” as flat file system log files! BTW, see also my previous question here.
That example was from my prior employer and is not publicly available. I am now at Rasa but you can use the existing tracker_store.py to get started. You would pick the class for the tracker store you are currently using or override the save method for that store.
However, I would no longer take this approach to create a logfile of the tracker events. Instead, you can use the default RabbitMQ service to create the store. I did this for a recent personal project of mine and described it in a blog post here.
Thanks @stephens for the link to your interesting blog. Yes, the RabbitMQ could be a convenient option for high traffic scenario.
I feel the original @andymayer request is a very common need for any (beginner) RASA developer and the lack of any conversations logging feature, perplex newbies (like me).
So Ok, one could:
instantiate a custom Tracker class,
or get tracker data feed via a message queue as you suggest (maybe optimal in case of really heavy traffic, to split logging from the engine load,
or log externally (easy to do if client application interfaces RASA through RASA Core REST APIs, by example). Also, one could use RASA X to do nice analytics!
But my praise to RASA team is to supply ready-made simple log file option for the rasa run server. Just as a baseline.
Thank you @stephens . I was trying to implement a custom tracker store using Couchbase as the DB. Being a novice, I’m finding it very difficult. Any advice or reference as to how to proceed in this situation?
In your case, there is no file or directory named customTrackerStore and you should be using type not store_type. Assuming your class in the customTrackers.py is called CustomTrackerStore, it should be:
Hi @stephens , I have tried changing the way you have mentioned, However RASA is still unable to find the trackerstore. Also It does not throw any detailed exception or error on how it is unable to find it,
Any help on this is greately appreciated.