How can we get the corresponding values of intent and slot while chatting with bot?

Hi, I am trying to use deeppavlov. I want to get the results of its intent detection and slot filling while talking to the robot. What should I do?

Did you take a look at our latest tutorial? It gives you examples :wink:

Check out here:

More specifically, in the end of the tutorial we show examples which help in getting the output you wanted:

The line

bot(["What is the harvesters status?"])[0][0].actions_tuple

Returns a tuple where first item is the name of the action, and the second item is information about detected slots (empty in this particular case).

The line

bot(["Which harvester requires repairs?"])[0][0].get_nlu_info()["intent"]

Returns you the detected intent’s name.

Let me know if this helps!

Thank you so much!
But I got this error:
from deeppavlov import build_model, configs
bot = build_model(configs.go_bot.gobot_dstc2_best, download=True)
AttributeError: ‘str’ object has no attribute ‘get_nlu_info’
What should I do?

Thanks, there’s a small bug in the tutorial.

However, we welcome you to use code from this demos repo:

Take a look at 214-216 lines:

  uttr_resp, conf = gobot(sentence)
  intents = uttr_resp["intents"]
  slots = uttr_resp["slots"]
  response = gobot.getNlg(uttr_resp)

Let me know if this works!

I have tried repalce the “sentence” as [“start”] or “start”, none of these works. :sob:

Wait :slight_smile: I’m sure you didn’t follow all steps cause we didn’t publish full tutorial (yet).

In general, you need to:

  1. follow Google Colab Tutorial
  2. train model in it
  3. download model
  4. clone repo above
  5. switch to gobot_gone branch
  6. copy downloaded model’s folder to corresponding folder in skills/harvesters_maintenance_gobot_skill/
  7. edit in the same folder of the gobot-based skill to output both intents and slots; maybe add additional endpoint to if you want
  8. build entire solution with docker-compose build
  9. run entire solution with docker-compose up