Create New Conversational BOT using go_bot model

I am trying to create a new custom Conversational BOT using the go_bot, my new bot is a banking helper bot which interacts with the user, fulfil their requests as “giving the bank account details” after authenticating them “for authentication I used mobile number registered with the bank accounts”.

The bot should be something like this,
chat1
chat2

In the example above, the bot takes the mobile number , confirms it and fetches the details from the db using the mobile number as primary key to give the account balance.

As I am new to deeppavlov, I dont know how to proceed, for the mean while I am creating a dataset similar to the “simple-dstc2-trn.json” used in go_bot, something like this,

I also understood the end-to-end working of the go_bot, like prepare dataset, train a slotfiller model & a bot model. But I am not sure will this work or not.

Any help to me for how to proceed further will be appreciated.
Thanks in advance.

Hi @bhavesh.srivastava,

You should follow tutorial on gobot in examples/ github directory.

  1. You should replace simple-dstc2-trn.txt with your training data, simple-dstc2-val.json with validation data and simple-dstc2-tst.txt with test data.
  2. Check that DatasetIterator outputs similar data sctructures for your dataset as for DSTC2 dataset.
  3. Then build slot filler. Slot filler used in the tutorial only supports slots with finite number of slot values. You can build your own slot_vals.json, where values are all possible number values, or use neural network based slot filler instead.
  4. Train bot.

Best,
Mariia

Thanks @vimary.
I tried the same manner, replaced the training, val & test data with my own data. The training data looks like this:

Also, I have created a new template file & slot file as per my data. The template file is like this:

I tried training it, initially the process started, but stopped in the middle with this error message:

its has some reading error with the template file, either my format has some problem or something else, I am unable to resolve this issue.

Any help will be appreciated.

Thanks.

Hello,
I have solved the error and its working now. Thanks for your support @vimary .

Now the bot is working end-to-end, and giving responses. I have a problem in api_call with the database. I have defined two slots (“mobile” & “account_type”), but the bot is not identifying the slot value of “mobile” if its an integer values, e.g. {“mobile” : “9514188759”} and the api call is only happening taking “account_type” with it.

I am getting this:
2019-09-16 15:11:06.138 INFO in ‘deeppavlov.models.go_bot.network’[‘network’] at line 485: Made api_call with {‘account_type’: ‘savings’}, got 2 results.

But on the other hand if i change the value of slot “mobile” to any string say “mine”, e.g. {“mobile” : “mine”}, then the bot is actually taking both the slots on API_CALL.
And I am getting this:
2019-09-16 15:41:45.634 INFO in ‘deeppavlov.models.go_bot.network’[‘network’] at line 485: Made api_call with {‘account_type’: ‘savings’, ‘mobile’: ‘mine’}, got 1 results.

which is needed.

Please help me in resolving this issue, like how can I make it work with the int values inside " " as a slot value.

This is how my database looks like:
db

Thanks.

Hi @bhavesh.srivastava,

That’s great that almost everything works now!

Do you use slotfill_raw model for slot-filling? Does your slot_vals.json file contains {“modile”: “9514188759”} pair?

Hi @vimary,

Yes, I have slot values defined in slot_vals.json , something like this:

slot_vals

I need to know, whether anything is there in the db reading module or slot matching module that it only reads or recognises string(str) datatypes such as “food”: { “caribbean”: [“carraibean”,“carribean”, “caribbean”], “kosher”: [ “kosher” ], “french”: [ “french” ] }, but doesn’t identifies {“mobile”: “8680924286”} ?

Or simply its a training problem, as I am supplying very small training data set ?

slotfill_raw can only recognize slot values that are present in slot_vals.json file. If that’s not the case, then it should be train data size that is too small. Try to increase training data for the mobile slot. Numbers as slot values should work fine.

Hello @vimary,

Thanks for your response, but I don’t think so its only the problem of too small training data.
As I have increased the data and tried re-training the bot. But the problem remains same.

For e.g.,
if i supply mobile slot value as int “9415188759” , the api call doesn’t includes the mobile slot and only includes the account_type slot which is having a value “savings”.

After giving the account type value as “savings”, the api call is made and fetches 3 results and giving the top result as reply.
I have 3 records in my db, with “savings” account type but they have unique “mobile”, as the api call is only working with slot account_type, that why getting all 3 results with “savings” account_type.

This how my db is:
db1

But, on the other hand if i try to give mobile slot value as “kia” (which is saved in db), the api call consists of both the slots , i.e, account_type & mobile and the queried result will exactly be 1 matching with both the slot values.

This made me to think that, may be the slotvalue+api_call is only working with the characters not with the integers or numbers, even after defining the slot values in slot_vals.json. May be the module code is written to match only character datatypes only.

Also for reference, this is my slot_vals.json file,


where, kia is working but 9415188759 doesn’t.

Hi,

GoBot uses spacy_tokenizer model which by default filters non alpha words.
Set tokenizer’s parameter alphas_only to False, then all numeric slot values should be recognized.

Hello @vimary,

Thanks for your response, I tried setting the alphas_only to False, which are there in the spacy_tokenizer.py file.

And tried retraining the module, but there is no effect in the results, its still not recognising the numeric slots.

Have you tried replicating the scenario with the data we have sent you?

Did you install deeppavlov in editable mode? Maybe you changes of code are not used.
You should have installed deeppavlov with

cd deeppavlov
pip3 install -e .

Yes, with this edit numbers are recognized in the model you sent me.

1 Like

Thanks @vimary, its working now from my end also. Thanks for your support.

1 Like

Can SimpleDSTC2DatasetReader read from a local file instead of a url?

Yes!

It downloads the data only when the paths for some portion of data are missing. So you can feed it with your dataset by placing and naming trn, tst and val files to mimick the downloaded ones.