Saving conversations to MongoDB


(Ahson) #1

So I have seen this been asked a few times, but I still can’t solve the issue.

I want to log conversations with my bot in a mongoDB collection. I currently use cmdline and start the bot using a makefile command containing endpoints.yml .

python -m rasa_core.run -d models/dialogue -u models/current/nlu --endpoints endpoints.yml --connector "twilio" --port 5002 --credentials dev_credentials.yml --enable_api --debug

I know this is being recognized because my actions/core servers are working properly. Inside the endpoint.yml file, I have the following for tracker store…

tracker_store:
    store_type: mongod
    url: mongodb://localhost:27017
    db: rasa
    username: admin
    password: xyz123
    collection: conversations

I set up a rasa database and a conversation collection using the mongoDB shell, and added a username and password for only the rasa database. I can verify both the database and the collection exist using the shell/python.

After I run my bot, i query the mongodb database using python/shell and I don’t see any inserts/updates during/after the conversation.

Are conversations saved on a message by message basis, or does it record slot values at the end of the conversation? The docs are not explicit about what type of logging actually occurs…

I am not sure if the tracker_store is having trouble authenticating…or if the MongoDB Tracker Store method is even being called. If anyone has any ideas on how to debug/address the issue let me know! I would really appreciate it!!!


(Ashukrishna100) #2
db= MongoTrackerStore( domain,host='mongodb://localhost:27017', db='rasa', username=__, 
			password=____,collection='conversations',event_broker=None)

Then pass db to agent Agent= Agent(domain,interpreter,tracker_store=dB,endpoint)


(Souvik Ghosh) #3

upgrade to rasa core 0.12 to enable tracker_store by using endpoints.yml file


(Ashukrishna100) #4

Also

From rasa_core.tracker_store import MongoTrackerStore