Search code examples
actions-on-googlegoogle-voice-actions

Custom entities in actionssdk


Working with google actionsSDK and trying to figure out how can I include custom entities in the action package. I found here manual: https://developers.google.com/assistant/conversational/action-package/reference/QueryPatterns but this manual is short and they do not provide the way where should be custom types included.

Does any of you have experience with it?


Solution

  • Well yea, google documentation for actions SDK, no comment. Based on the example you provided these custom types belongs to the main structure in actions.json like:

    "actions":[..],
    "locale": "de",
    "customTypes": [
        {
          "name": "$MorningOptions",
          "items": [
            {
              "key": "6am",
              "synonyms": [
                "6 am",
                "6 o clock",
                "oh six hundred",
                "6 in the morning"
              ]
            }
          ]
        }
      ]
    

    If this is not working, you can try using types:

    "actions":[..],
    "locale": "de",
    "types":
      [
        {
          "name": "$MorningOptions",
          "entities":
          [
            { "key": "6am", "synonyms": ["6 am","6 o clock","oh six hundred","6 in the morning"] }
          ]
        }
      ]
    

    Those are also in the main structure. But officially are deprecated: https://developers.google.com/assistant/conversational/action-package/reference/rest/Shared.Types/ActionPackage#Type