def create_entity(project_id, entity_type_id, entity_value, synonyms):
import dialogflow_v2 as dialogflow<EOL>entity_types_client = dialogflow.EntityTypesClient()<EOL>synonyms = synonyms or [entity_value]<EOL>entity_type_path = entity_types_client.entity_type_path(<EOL>project_id, entity_type_id)<EOL>entity = dialogflow.types.EntityType.Entity()<EOL>entity.value = entity_value<EOL>entity.synonyms.extend(synonyms)<EOL>response = entity_types_client.batch_create_entities(<EOL>entity_type_path, [entity])<EOL>print('<STR_LIT>'.format(response))<EOL>
Create an entity of the given entity type.