-
Notifications
You must be signed in to change notification settings - Fork 141
Update an Intent #68
Comments
If you look at the type of an intent's training phrases attribute, you'll notice that it's a <google.protobuf.pyext._message.RepeatedCompositeCo>. I'm not sure if this is exactly how you are supposed to do it, but I would first get the intent from the agent, then modify it, and then use it as an argument for update_intent.
get_intent should be a function that I believe you can find in one of the samples Trying to figure these things out can be pretty infuriating right now since DialogFlow is pretty knew, but the tools are all there so as long as you're patient, you'll figure it out. |
Sorry if what I said earlier was a bit murky.
|
Hello everyone! I've tried to call the method like this: A print just before that line shows that the intent is correct. Any ideas? |
You need to pass Training phrases should be defined as follows: https://github.com/dialogflow/dialogflow-python-client-v2/blob/cdb21e624bc0e69518296fa6ef1b5f2746cdcadc/samples/intent_management.py#L70-L76 Here is an updated version of 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(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='en') |
@tigersoldier In shorts, How to specify the entities in training phrase? |
@progresivoJS |
Hi, this appears to have been answered, but if anyone needs further help here is the docs on BatchUpdateIntentsRequest |
here it is treating entire text as entity, how can i specify specific word in the text as entity. |
how can i delete the current text response and change it to something else?? |
Hi,
can anyone please tell how to update an intent using update_intent? for example, if I want to add some more training phrases after intent has been created or to add message text after intent creation
Thanks
The text was updated successfully, but these errors were encountered: