How to get user input and store them into training data - Rasa Open Source - Rasa Community Forum

👋 Introducing the Rasa Playground

How to get user input and store them into training data

post by Ajinkz on Dec 21, 2018

How can we store input from user ? If bot is unable to answer some question then that question should be stored into data and nxt time we can train the data with its answer so that bot will learn

post by srikar_1996 on Dec 21, 2018

You can log the conversation to your database, Redis or inmemory storage, which you can access later. The whole conversation will be logged. Tracker Stores

post by ashukrishna100 on Dec 21, 2018

Use logging. Save the conversation in Mongotrackerstore which sends to mongodb

Retrieve data from mongodb. And add them in your data file

post by Ajinkz on Jan 8, 2019

But what if I want to directly add it to nlu.md file ? under some intent ?

post by ashukrishna100 on Jan 10, 2019

Use dialoguestate tracker. Using custom action you can add to the training data directly. Even with the help of agents you can do that.

post by Ajinkz on Jan 10, 2019

Can you please elaborate . how can we use dialogue state tracker ?

post by ashukrishna100 on Jan 10, 2019

from rasa_core.trackers import EventVerbosity

tracker = agent.tracker_store.get_or_create_tracker(s_id)
state = tracker.current_state(event_verbosity = EventVerbosity.ALL)
print(state)

post by Ajinkz on Jan 10, 2019

Actually my concern is little bit different. ultimately what I want to do is to collect the user input that lead to fallback, so that i could further train the model with that data

post by srikar_1996 on Jan 10, 2019

Once you’ve logged the conversations to DB you can use that to retrain. I don’t think you can directly add those phrases to the nlu.md file. You’ll have to identify and manually add the examples there or use interactive learning with those new phrases.

post by ashukrishna100 on Jan 10, 2019

He can write a custom code to directly add those inputs from the tracker to nlu.md file.

post by Ajinkz on Jan 10, 2019

I was thinking to write code in action.py which can directly write that user input into some ##intent:unknown . I dont known whether there is any better approach. Please do suggest.

post by ashukrishna100 on Jan 10, 2019

Dont use custom action as it will go as per the story what if the user lefts the conversation in the middle? Use tracker to get the conversation. The best way is to get the conversation from tracker current state and export it to .md file.

post by srikar_1996 on Jan 10, 2019

Even if you write it this way, you’d have to re-train the NLU again right? I don’t think it trains on the fly.

post by ajaxwini on Mar 12, 2019

Hello friend,Could you please tell me how are you fetching specific details from the tracker store. Elaborating my doubt below:

db = MongoTrackerStore(domain=“d.yml”,host=‘host ip’, db=‘xyz’, username=“x”,password=“x”,collection=“x”,event_broker=None)

agent = Agent.load(‘models/dialogue’, interpreter=‘models/current/nlu’,action_endpoint = action_endpoint,tracker_store=db)

now i want to fetch some data like db.sender_id or db.event. the reason of doing it is to store it column wise on my mongodb.Please help me solving this problem.

post by Abir on May 23, 2019

Hello , i get your point . See when bot is unable to handle any input , it’s because NLU has failed . If you would have added fallback policy while training you dialogue model , that will just solve your problem . So if the accuracy is below the predefined threshold of fallback policy , fallback action will trigger . Within fallback action get the latest message ( via “tracker.latest_message[‘text’]” ) and since you know it was because of this input fallback is triggered , definitely this input has failed for NLU .Then you can just write log or even a simple text file to save all those inputs. Hope it helps !

post by visam on May 30, 2019

How do we access the Inmemorystorage?

post by visam on May 30, 2019

Can you please elaborate or share a repository if you were successful in the extraction?

post by jeng on Nov 24, 2019

hi, i have the same issue with you too and also would like to know how collect user input into a file so i can retrain it if it doesn’t belong to any correct/not existing intent. you figure the way of doing this? thanks

post by iampkk on Feb 10, 2020

Hi all. I am new to rasa. I want to grab the user’s input and validate it in the backend in actions.py. So how do I store the input given by user in a variable without using entity or slots and use that in actions.py.

post by ramyaps on Feb 15, 2020

Hi Ajinkz, Have u found the solution for this issue. i am also came across with this. please give me the details

post by KarthiAru on Feb 15, 2020

I would advice against automatically changing your nlu.md file. Instead, you can setup an annotation process either in RasaX or your custom tool to annotate the data. The output of which can be written directly to your file.

post by akelad on Feb 17, 2020

Hey @iampkk you can do that by using entities, and only filling the slot once you’ve validated the entity. In general, Forms may be a good approach.