4

I have dataset having user queries and and responses. The dataset size is around ~50k. The data is stored in csv file having two columns for query and response respectively. How to train dialogflow using this dataset? Can I train it using python api? Its mentioned in their docs- https://dialogflow.com/docs/training-analytics/training . But I am unable to figure out how to train it? I want to train like this- https://miningbusinessdata.com/reader-question-automating-dialogflow-training/. But I am not able to fully understand how to do that.

shivank01
  • 1,015
  • 3
  • 16
  • 35

1 Answers1

1

You can just upload a TXT file containing a list of user queries for training. The process is described here. An alternative is to use the REST interface to update intents and add the training data as sample invocations via batchUpdate or use export/import to add your training phrases (I haven't tried this option).

  1. for TXT Upload: You can't upload the response, the response will be automatically determined with the current training.

    • Upload txt file with one line each for each user request (no other markup and no responses)
    • Switch to the "Training" menu and click on the uploaded conversation, you will see a list of user requests
    • Check if the user requests are matched with the correct response, if not, correct it
    • There's a button at the top to accept the result and the agent will train based on this new data
  2. For batch upload or export/import The function you mention for train is just a function to kick off training, not to add training data. You can however use the bach upload to add intents including sample invocations.

    • This is the HTTP request format POST https://dialogflow.googleapis.com/v2/{parent=projects/*/agent}/intents:batchUpdate
    • Give the batch as either URI or inline. You should be able to use updateMask to just update the training phrases
    • The documentation has more details but if you use inline, you send an intentBatch which contains a list of intents and each intent looks like this
    • You could also first export your project, add the training phrases in an automated script and then import the project again using projects.agent.import (see more here)
lisa p.
  • 2,138
  • 21
  • 36
  • Is there a way so that I can upload both question and answers for training? Something like this- https://miningbusinessdata.com/reader-question-automating-dialogflow-training/. I am not able to fully understand how to do that. – shivank01 Jan 17 '19 at 03:45
  • This describes my second option using export/import but as a tool. You could follow the steps in that document. Add some sample training phrases via Dialogflow, then export the project and look at the structure. You mentioned Python in your question, it should be doable to write a Python script that reads your large dataset and outputs a json that is similar to your exported project. Then you can import the new data. – lisa p. Jan 17 '19 at 09:33
  • The link you have mentioned is 2nd option 3rd point is not working. It is giving 404 error. – shivank01 Jan 19 '19 at 08:30
  • Sorry, I fixed the link now. – lisa p. Jan 20 '19 at 11:47