有一个带有实体及其同义词的函数。这可能是正确的功能,但是如何正确使用它呢?
“ projects / small-talk-f59 / agent / entityTypes / firstName”上的403 IAM权限“ dialogflow.entityTypes.createEntity”被拒绝。
def create_entity(project_id, entity_type_id, entity_value, synonyms):
"""Create an entity of the given entity type."""
entity_types_client = dialogflow.EntityTypesClient()
# Note: synonyms must be exactly [entity_value] if the
# entity_type's kind is KIND_LIST
synonyms = synonyms or [entity_value]
entity_type_path = entity_types_client.entity_type_path(
project_id, entity_type_id)
entity = dialogflow.types.EntityType.Entity()
entity.value = entity_value
entity.synonyms.extend(synonyms)
response = entity_types_client.batch_create_entities(
entity_type_path, [entity])
print('Entity created: {}'.format(response))
我希望在调用函数后出现一个新对象,如图所示 https://drive.google.com/file/d/1OsPm3f3eUAxyjgwlY-FKAw0ArjA88G0r/view?usp=sharing