0

I am very newbie with the Google DialogFlow, As I am exploring with the Api.ai. I got to know about the userEntity(V1) or SessionEntity(V2).

I have created the session entity using fulfilment with the below code:

import requests

REQUIRED_SCOPES = 'https://www.googleapis.com/auth/dialogflow'
access_token = generate_access_token()

url = 'https://dialogflow.googleapis.com/v2/'+ session_id +'/entityTypes'
headers = {'Authorization': 'Bearer '+ access_token,'Content-Type': 'application/json'}

entity_data = json.dumps({"entityOverrideMode": "ENTITY_OVERRIDE_MODE_OVERRIDE", "entities": [{"synonyms":["sugarcane", "sugar"],"value": "sweet"}], "value": str(session_id)+'fruit'})
response = requests.post(url,headers=headers,data=entity_data)

It creates the sessionEntity with success and also able to list the entity from the session.

It's working while I tried from the same page of console with TryMe-Intents.

But while I tried using simulator or mobile to pass some phrases for my Intent I am not getting the newly created entity to map with the matching phrases.

For Example, I want Sugarcane, at this point, I suppose to get sugarcane as mapped with the entity with the current session for followup intents.

But it was not happening, don't know if I am missing anything. Let me know if anything is wrong or missing.

Suggestions are always welcome.

Reference Links which I have referred to achieve:

  1. https://cloud.google.com/dialogflow-enterprise/docs/reference/rest/v2/projects.agent.sessions.entityTypes/create

  2. https://cloud.google.com/dialogflow-enterprise/docs/entities-session

Jeenit khatri
  • 318
  • 4
  • 19

0 Answers0