Python 3.x 在dialogflow中发送批创建实体请求时出现问题
我已经定义了以下函数。目的是使用dialogflow客户端发出批量创建实体请求。在发送了许多单独的测试后,我使用了这种方法 问题似乎在于定义EntityType的行。看起来“entityType”无效,但这是dialogflow v2文档中的内容,我正在使用的当前版本 关于这个问题有什么想法吗Python 3.x 在dialogflow中发送批创建实体请求时出现问题,python-3.x,dialogflow-es,Python 3.x,Dialogflow Es,我已经定义了以下函数。目的是使用dialogflow客户端发出批量创建实体请求。在发送了许多单独的测试后,我使用了这种方法 问题似乎在于定义EntityType的行。看起来“entityType”无效,但这是dialogflow v2文档中的内容,我正在使用的当前版本 关于这个问题有什么想法吗 def create_batch_entity_types(self): client = self.get_entity_client() print(DialogFlowClient.
def create_batch_entity_types(self):
client = self.get_entity_client()
print(DialogFlowClient.batch_list)
EntityType = {
"entityTypes": DialogFlowClient.batch_list
}
response = client.batch_update_entity_types(parent=AGENT_PATH, entity_type_batch_inline=EntityType)
def callback(operation_future):
# Handle result.
result = operation_future.result()
print(result)
response.add_done_callback(callback)
运行函数后,我收到了此错误
Traceback (most recent call last):
File "df_client.py", line 540, in <module>
create_entity_types_from_database()
File "df_client.py", line 426, in create_entity_types_from_database
df.create_batch_entity_types()
File "/Users/andrewflorial/Documents/PROJECTS/curlbot/dialogflow/dialogflow_accessor.py", line 99, in create_batch_entity_types
response = client.batch_update_entity_types(parent=AGENT_PATH, entity_type_batch_inline=EntityType)
File "/Users/andrewflorial/Documents/PROJECTS/curlbot/venv/lib/python3.7/site-packages/dialogflow_v2/gapic/entity_types_client.py", line 767, in batch_update_entity_types
update_mask=update_mask,
ValueError: Protocol message EntityTypeBatch has no "entityTypes" field.
回溯(最近一次呼叫最后一次):
文件“df_client.py”,第540行,在
从数据库()创建实体类型
文件“df_client.py”,第426行,从数据库创建实体类型
df.创建批处理实体类型()
文件“/Users/andrewflorial/Documents/PROJECTS/curlbot/dialogflow/dialogflow\u accessor.py”,第99行,在创建批处理实体类型中
响应=客户端。批处理\更新\实体\类型(父级=代理\路径,实体\类型\批处理\内联=实体类型)
文件“/Users/andrewflorial/Documents/PROJECTS/curlbot/venv/lib/python3.7/site packages/dialogflow\u v2/gapic/entity\u types\u client.py”,第767行,批量更新\u entity\u types
更新\u掩码=更新\u掩码,
ValueError:协议消息EntityTypeBatch没有“entityTypes”字段。
实体类型批处理内联的参数必须与实体类型批处理的形式相同
看看那种类型是什么样子:
它必须有实体类型
字段,而不是实体类型