Nlp 使用DialogFlow Detectinent不会';我不能正常工作
我使用DialogFlow v2(并尝试使用v2Beta1),使用python中的SDK,问题是Detectinent方法无法识别查询输入中的参数 因此,为了寻找解决方案,我使用简单的cUrl调用重新创建了这个问题 接下来是创建EntityType的旋度:Nlp 使用DialogFlow Detectinent不会';我不能正常工作,nlp,dialogflow-es,agent,Nlp,Dialogflow Es,Agent,我使用DialogFlow v2(并尝试使用v2Beta1),使用python中的SDK,问题是Detectinent方法无法识别查询输入中的参数 因此,为了寻找解决方案,我使用简单的cUrl调用重新创建了这个问题 接下来是创建EntityType的旋度: curl -X POST -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \ -H "Content-Type: applica
curl -X POST -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
"https://dialogflow.googleapis.com/v2beta1/projects/myproject_id/agent/entityTypes?languageCode=es" \
--data "{
'displayName': 'customer',
'kind': 'KIND_MAP',
'autoExpansionMode': 'AUTO_EXPANSION_MODE_DEFAULT',
'entities': [
{
'value': 'one',
'synonyms': [
'one', 'uno'
]
},
{
'value': 'two',
'synonyms': [
'two', 'dos'
]
}
],
'enableFuzzyExtraction': true
}"
工作正常,EntityType已创建
现在,创建意图:
curl -X POST -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
"https://dialogflow.googleapis.com/v2beta1/projects/myproject_id/agent/intents" \
--data "{
'displayName': 'ExampleIntent',
'priority': 500000,
'mlDisabled': false,
'trainingPhrases': [
{
'type': 'EXAMPLE',
'parts': [
{
'text': 'start '
},
{
'text': 'one',
'alias': 'customer',
'entityType': '@customer',
'userDefined': true
}
]
},
{
'type': 'EXAMPLE',
'parts': [
{
'text': 'begin '
},
{
'text': 'one',
'alias': 'customer',
'entityType': '@customer',
'userDefined': true
}
]
},
{
'type': 'EXAMPLE',
'parts': [
{
'text': 'do '
},
{
'text': 'one',
'alias': 'customer',
'entityType': '@customer',
'userDefined': true
}
]
}
],
'action': 'start',
'messages': [
{
'text': {
'text': [
'Hi'
]
}
}
],
}"
也很好用
现在,我试着去发现它的意图:
curl -X POST -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
"https://dialogflow.googleapis.com/v2beta1/projects/myproject_id/agent/sessions/0:detectIntent" \
--data "{
'queryInput': {
'text': {
'text': 'do one',
'languageCode': 'es'
}
}
}"
响应没有参数:
{
"responseId": "de68c5f5-6aa9-4716-ac22-626a22fc5d43-b81332aa",
"queryResult": {
"queryText": "do one",
"action": "start",
"parameters": {},
"allRequiredParamsPresent": true,
"fulfillmentText": "Hi",
"fulfillmentMessages": [
{
"text": {
"text": [
"Hi"
]
}
}
],
"intent": {
"name": "projects/myproject_id/agent/intents/20ab36d6-e8c8-40d6-87dc-78a61e2de600",
"displayName": "ExampleIntent"
},
"intentDetectionConfidence": 1,
"languageCode": "es"
}
}
我试着训练:
curl -X POST -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
"https://dialogflow.googleapis.com/v2beta1/projects/myproject_id/agent:train"
结果是一样的
但是,如果我转到web控制台,输入意图并单击保存按钮。。。探测器开始工作了
{
"responseId": "45c919dc-677d-4ae4-8572-588955cd5414-b81332aa",
"queryResult": {
"queryText": "do one",
"action": "start",
"parameters": {
"customer": [
"one"
]
},
"allRequiredParamsPresent": true,
"fulfillmentText": "Hi",
"fulfillmentMessages": [
{
"text": {
"text": [
"Hi"
]
}
}
],
"intent": {
"name": "projects/myproject_id/agent/intents/20ab36d6-e8c8-40d6-87dc-78a61e2de600",
"displayName": "ExampleIntent"
},
"intentDetectionConfidence": 1,
"languageCode": "es"
}
}
我错过了什么
多亏了任何关于如何使这项工作成功的线索。好吧。。。经过几次研究,我发现了问题,我缺少createIntent中的参数:
curl -X POST -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
"https://dialogflow.googleapis.com/v2beta1/projects/myproject_id/agent/intents" \
--data "{
'displayName': 'ExampleIntent',
'priority': 500000,
'mlDisabled': false,
'parameters': [
{
'displayName': 'customer',
'entityTypeDisplayName': '@customer',
'value': '$customer'
}
],
'trainingPhrases': [
{