在 Python 中使用 Dialogflow v2 api 创建意图

Creating intents using Dialogflow v2 api in Python

我正在尝试使用 python v2 库在我的 Dialogflow 代理中创建意图。我是新手,python 文档对我帮助不大。这是我到目前为止的代码,它给了我“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)

知道我做错了什么吗?

用 keyword/named 参数调用 create_intent?比如create_intent(parent-parent, intent=intent).