0

Using createSessionEntityTypes I have created a session entity which is added to already existing entity type if I make use of listSessionEntityTypes I can view the created new entity but if I try with my DialogFlow it's not recognized by it.

As an example: I created an entity named kitchen and now if I try to access it saying "Turn on kitchen light" kitchen is not recognized by the light entitytype.

It is weird because when I use listSessionEntitytypes I see kitchen in that list but my DialogFlow is not recognizing it as Entity when I speak. Here is the code that I am working on:

function createSessionEntityType() {
    const sessionEntityTypesClient = new 
    dialogflow.SessionEntityTypesClient();
    const entityType = 'any';

    const sessionPath = `sessionpath`;
    const sessionEntityTypePath = `sessionentitypath`;
    const entities = [{
       "value": "Library",
       "synonyms": ["Study room"]
    }];
    const entityOverrideMode = "ENTITY_OVERRIDE_MODE_OVERRIDE";

    const sessionEntityTypeRequest = {
        parent: sessionPath,
        sessionEntityType: {
            name: sessionEntityTypePath,
            entityOverrideMode: entityOverrideMode,
            entities: entities,
        },
    };

    sessionEntityTypesClient
    .createSessionEntityType(sessionEntityTypeRequest)
    .then(responses => {
        console.log('SessionEntityType created:', responses);
    });
  }

Intent picture

manu
  • 21
  • 1
  • 4
  • Can you update your question to clarify a few things? It isn't clear if you're trying to create a new type, or create a new entity that you're adding to a type. Can you show the code to illustrate what you're doing? And possibly show the Intent that is using it and how you expect it to be used? – Prisoner Oct 11 '18 at 00:06
  • i have updated it if anything more needed please let me know – manu Oct 11 '18 at 19:48
  • Can you update your question to include a screen shot showing an Intent where you use this Entity type? – Prisoner Oct 11 '18 at 19:50
  • sure added intent picture down to the code. – manu Oct 11 '18 at 21:06

2 Answers2

0

While it isn't entirely clear, it looks like the problem is that your Intent doesn't actually use the Entity Type that you're creating. None of the "room" like words in your Intent are highlighted or matched to an Entity type.

You need to have created the Entity Type first, and you can then use the API to update the specific values in it. Once you've done this, you can also highlight the relevant words in your phrase to match them to a specific Entity Type, even if you don't have any Entities in it.

Even tho you have to have created the Entity Type, since you're updating the Entities inside a session, they will never show up in the Dialogflow UI. Users who are saying phrases in the same session where the Entities were created, however, should still get matches.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • I have tried this the problem exists the same place where it has to update the specific values through API in existing entity type. It's not working! – manu Oct 11 '18 at 21:51
  • Then please provide examples. As many details as you can give will help us help you. I've edited Entities dynamically without problems, so I'm trying to understand exactly what you're doing and exactly what the problem is. – Prisoner Oct 11 '18 at 22:37
  • https://github.com/googleapis/nodejs-dialogflow/blob/master/samples/resource.js I am following this code to create an entity and when I have created an entity it shows in the logs of dialog flow but it is not updating at the entities section of dialogflow inside the entity type I am trying to create it. For example, as I am trying to create library entity inside a light entity type it shows in the response of the function in logs if I console it but it's not showing up in the entities section of the dialogflow inside the light entity type – manu Oct 12 '18 at 16:26
  • Answer updated, but it still isn't clear (either from here or from your posts on G+) exactly how you're using the Entity Type. Clarifying your question to show how you're using it (the Intent in question along with a conversation, for example) and what is or isn't happening will help. – Prisoner Jan 04 '19 at 19:58
-1

please check your all syntax and function call definition, to call entity value from session entity entityValue array must as per syntax.