Scott Daniel
Scott Daniel

Reputation: 1103

How do you get arguments of correct type in Google Actions SDK?

Google's action api seems to find the right pattern in my intent and bind to the right type, but does not return the parsed type data. For example, if I have the intent defined below in my actions.json file:

   {
     "description": "",
      "initialTrigger": {
        "intent": "RepeatIntent",
        "queryPatterns": [
          {
            "queryPattern": "say $SchemaOrg_Number:mynumber"
          },
          {
            "queryPattern": "say $SchemaOrg_Date:mydate"
          },
          {
            "queryPattern": "say $SchemaOrg_Time:mytime"
          }
        ]
      },
      "httpExecution": {
        "url": "https://myurl/repeat"
      }
    }

and I enter, "at my action say tomorrow" into the simulator, I receive the following arguments:

"arguments": [
    {
        "name": "mydate",
        "raw_text": "tomorrow",
        "text_value": "tomorrow"
    },
    {
        "name": "trigger_query",
        "raw_text": "say tomorrow",
        "text_value": "say tomorrow"
    }
]

Note that the action SDK correctly identified "tomorrow" as type "$SchemaOrg_Date" and bound it to the mydate variable, however, it did not return the "date_value" element in the return json as specified in the documentation. I would have expected that "date_value" element to contain a parsed date structure (per the document).

The same is true of numbers although they behave slightly differently. For example, if I use the phrase "at my action say fifty", I'll receive these arguments:

"arguments": [
    {
        "name": "mynumber",
        "raw_text": "50",
        "text_value": "50"
    },
    {
        "name": "trigger_query",
        "raw_text": "say fifty",
        "text_value": "say fifty"
    }
]

Note that the $SchemaOrg_Number was recognized and "fifty" was correctly parsed to "50", but the int_value wasn't populated in the argument json per the documentation.

Google is actively parsing these complex types and has documented that they should be returned so I don't want to go to the trouble of parsing them myself. Any thoughts as to if this will be fixed any time soon?

Upvotes: 2

Views: 631

Answers (1)

Leon Nicholls
Leon Nicholls

Reputation: 4646

The Actions SDK does not support NLU for actions. You have to use your own NLU. If you don't have your own NLU, we recommend using API.AI.

Upvotes: 1

Related Questions