Search code examples
pythondialogflow-es

Creating intents using Dialogflow v2 api in Python


I'm trying to create intents in my Dialogflow agent using the python v2 library. I'm new to this and the python documentation isn't helping me much. This is the code I have so far, which gives me "TypeError: create_intent() takes from 1 to 2 positional arguments but 3 were given"

import os
from google.cloud import dialogflow_v2

os.environ["GOOGLE_APPLICATION_CREDENTIALS"]=r"C:\\path\\to\\credentials.json"

intents_client = dialogflow_v2.IntentsClient()
project = "my_project"
parent = intents_client.common_project_path(project)
intent = dialogflow_v2.types.Intent(
    display_name = "Renate's new Intent"
)
response = intents_client.create_intent(parent, intent)

Any ideas what I'm doing wrong?


Solution

  • Call the create_intent with keyword/named argument instead? Such as create_intent(parent-parent, intent=intent).