Reputation: 305
I have setup a Google Actions conversational project, with dialogflow and webhook intents served by my server in PHP.
Upon new dialogflow conversation startup, e.g. just before replying to the welcome intent, the php code is pushing some session entities to the dialogflow engine.
The dialogflow engine recognized correctly the session entity words until two weeks ago, when it suddendly stopped working (I have changed nothing in the code), and right now it's still not working.
The session entities are created with no errors (I added code to query dialogflow api and list session entitites after creation, and google is replying with all the words I send).
However the Intent does not recognize and does not fill in the entity parameters.
Here is the code I'm using to push the entities (using google dialogflow v2 library):
$names = [....array of strings....];
$parent = 'projects/inim-prova/agent/sessions/' . $sessionId;
$client = new SessionEntityTypesClient(['credentials' => $keyfile]]);
$entities = array_map(function($item) { return new Entity(['value' => $item, 'synonyms' => [$item]]); }, array_unique($names));
$entityType = new SessionEntityType([
'name' => $parent . "/entityTypes/$displayName",
'entity_override_mode' => EntityOverrideMode::ENTITY_OVERRIDE_MODE_SUPPLEMENT,
'entities' => $entities
]);
$client->createSessionEntityType($parent, $entityType);
this code runs with no exception thrown.
After a few lines I'm querying the server to see if everything is ok:
$req = $client->listSessionEntityTypes($this->webhookRequest->getSession());
foreach ($req as $element) {
Logger::log(Logger::DEV, __METHOD__, "SessionEntityType: " . $element->getName());
$entities = $element->getEntities();
foreach ($entities as $entity) {
$synonyms = [];
foreach ($entity->getSynonyms() as $synonym) $synonyms[] = $synonym;
Logger::log(Logger::DEV, __METHOD__, ">> " . $entity->getValue() . ": " . implode(', ', $synonyms));
}
}
and this is an extract from the debug log:
SessionEntityType: projects/inim-prova/agent/sessions/ABwppHHhgwxi5OGznpUtUq2D7BQrOKWB5Y5UYr20HRKI14iASKugPw2dL2VKMwfvZ193Mq_DUb2emQ/entityTypes/NomiLuoghiUscite
>> sala: sala
>> cucina: cucina
>> giardino: giardino
SessionEntityType: projects/inim-prova/agent/sessions/ABwppHHhgwxi5OGznpUtUq2D7BQrOKWB5Y5UYr20HRKI14iASKugPw2dL2VKMwfvZ193Mq_DUb2emQ/entityTypes/NomiUscite
>> luci: luci
>> irrigazione: irrigazione
>> cappa: cappa
therefore all the entities seem to be in the right place.
This is the intent training phrase:
(please note that ArticoliDeterminativi
and Preposizioni
are static entities which I'm ignoring).
and these are the parameters I get on webhook request when I say Accendi le luci in cucina
:
'parameters' => array (
'NomiUscite.original' => '',
'Preposizioni.original' => '',
'NomiLuoghiUscite' => '',
'NomiUscite' => '',
'Preposizioni' => '',
'ArticoliDeterminativi.original' => 'le',
'NomiLuoghiUscite.original' => '',
'ArticoliDeterminativi' => 'il',
)
As you can see, NomiUscite
and NomiLuoghiUscite
are empty. I expect them to be luci
and cucina
.
I'm really clueless.
Upvotes: 1
Views: 1231
Reputation: 305
It looks like it really was a dialogflow bug, not a flaw in my code. After a couple of week, Support guys from Google replied me telling that the issue has been resolved.
I've run again tests with no modification on code at all, and now it works.
Upvotes: 1
Reputation: 21
You should add words 'uscita' and 'luogo' to the Session Entities. I can how the parameters can be empty if you annotate words that are not part of the entity.
You also can try adding 'Accendi le luci in cucina' as a Training Phrase.
Upvotes: 0