Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def update_intent(project_id, intent_id, training_phrases_parts):
- client = dialogflow.IntentsClient()
- intent_name = client. intent_path(project_id, intent_id)
- intent = client.get_intent(intent_name, intent_view=dialogflow_v2.enums.IntentView.INTENT_VIEW_FULL)
- training_phrases = []
- for training_phrases_part in training_phrases_parts:
- part = dialogflow.types.Intent.TrainingPhrase.Part(
- text=training_phrases_part)
- training_phrase = dialogflow.types.Intent.TrainingPhrase(parts=[part])
- training_phrases.append(training_phrase)
- intent.training_phrases.extend(training_phrases)
- response = client.update_intent(intent, language_code='ru')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement