简体   繁体   English

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

[英]Creating intents using Dialogflow v2 api in Python

I'm trying to create intents in my Dialogflow agent using the python v2 library.我正在尝试使用 python v2 库在我的 Dialogflow 代理中创建意图。 I'm new to this and the python documentation isn't helping me much.我是新手,python 文档对我帮助不大。 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"这是我到目前为止的代码,它给了我“TypeError:create_intent() 从 1 到 2 个位置 arguments 但给出了 3 个”

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?任何想法我做错了什么?

Call the create_intent with keyword/named argument instead?用关键字/命名参数调用create_intent吗? Such as create_intent(parent-parent, intent=intent) .比如create_intent(parent-parent, intent=intent)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM