DaveLutz
DaveLutz

Reputation: 3

Google Actions SDK not passing arguments

I have been unable to get google-actions sdk for node.js to pass arguments. I installed the https://github.com/actions-on-google/actionssdk-eliza-nodejs sample project and noticed arguments are not working for that project either. Any insight?

In the web simulator I entered "i am feeling sad"

Here is the request I get

{
"query": "i am feeling sad",
"accessToken": "**masked**",
"expectUserResponse": true,
"conversationToken": "CiZDIzU4O..."content_copy,
"debugInfo": {
    "assistantToAgentDebug": {
        "assistantToAgentJson": {
            "user": {
                "user_id": "**masked**"
            },
            "conversation": {
                "conversation_id": "1484523995718",
                "type": 2,
                "conversation_token": "{\"elizaInstance\":{\"noRandom\":false,\"capitalizeFirstLetter\":true,\"debug\":false,\"memSize\":20,\"version\":\"1.1 (original)\",\"quit\":false,\"mem\":[],\"lastchoice\":[[-1],[-1],[-1],[-1],[-1,-1,-1],[-1,-1],[-1],[-1],[-1],[-1,-1,-1],[-1,-1,-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1,0,-1],[-1,-1,-1],[-1],[-1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[-1,-1,-1,-1],[-1],[-1,-1],[-1,-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1,-1,-1],[-1]],\"sentence\":\"i am feeling sad\"}}"
            },
            "inputs": [
                {
                    "intent": "assistant.intent.action.TEXT",
                    "raw_inputs": [
                        {
                            "input_type": 2,
                            "query": "i am feeling sad"
                        }
                    ],
                    "arguments": [
                        {
                            "name": "text",
                            "raw_text": "i am feeling sad",
                            "text_value": "i am feeling sad"
                        }
                    ]
                }
            ]
        }
    }
}
}

text_value should = "sad", not "i am feeling sad" based on eliza.json which has this:

{
"versionLabel": "Eliza v1",
"agentInfo": {
  "languageCode": "en-US",
  "projectId": "**masked**",
  "invocationNames": [
    "eliza"
  ],
  "voiceName": "female_1"
},
"actions": [
  {
    "description": "Start an Eliza consultation",
    "initialTrigger": {
      "intent": "assistant.intent.action.MAIN"
    },
    "httpExecution": {
      "url": "https://**masked**"
    }
  },
  {
    "description": "Deep link to Eliza consultation",
    "initialTrigger": {
      "intent": "raw.input",
      "queryPatterns": [
        {
          "queryPattern": "my emotional state is $SchemaOrg_Text:text"
        },
        {
          "queryPattern": "I am concerned about $SchemaOrg_Text:text"
        },
        {
          "queryPattern": "I am feeling $SchemaOrg_Text:text"
        },
        {
          "queryPattern": "I need to talk about my feelings"
        }
      ]
    },
    "httpExecution": {
      "url": "**masked**"
    }
  }
],
"deploymentStatus": {
  "state": "NEW"
},
 "versionId": "1"
}

Upvotes: 0

Views: 574

Answers (2)

Scott Daniel
Scott Daniel

Reputation: 1103

The Google Actions SDK will parse patterns and correctly bind arguments for intents that activate your action. For example, if you say

At my action I am feeling sad

You will recieve arguments that look like this

"arguments": [
    {
        "name": "text",
        "raw_text": "sad",
        "text_value": "sad"
    },
    {
        "name": "trigger_query",
        "raw_text": "i am feeling sad",
        "text_value": "i am feeling sad"
    }
]

However, if you request input from the action by setting expect_user_response to true, the arguments are always returned in raw form using the intent "assistant.intent.action.TEXT". It is up to you to parse those raw arguments as indicated in the other answer to this question.

Also note that as far as I can tell, the Schema_Org types are not returned per the documentation. More information here.

Upvotes: 1

Leon Nicholls
Leon Nicholls

Reputation: 4646

If you are using the Actions SDK, then you have to use your own NLP for understanding the raw user query and for extracting arguments. If you don't have you own NLP, then we recommend that you use API.AI.

Upvotes: 0

Related Questions