如何解决参数助手(WatsonServicesAssistant)的参数?

时间:2019-03-30 20:52:50

标签: python curl ibm-watson mendix

我正在尝试为IBM Watson chatbot的集成创建一个微流程,但是在解决它时遇到了问题。你能给我一个开始吗?

我尝试使用服务凭证,但无法弄清楚它们应该如何进入。

Skill Details

Skill Name: *skill name*
Skill ID:*skill ID*
Workspace ID:*Workspace ID*
Legacy v1 Workspace URL:https://gateway.watsonplatform.net/assistant/api...

Service Credentials

Service Credentials Name:*serivice credentials name*
Username:*userName*
Password:*password*

我没有正确的方法来放置凭据以创建我为聊天机器人尝试创建的微流的配置文件

1 个答案:

答案 0 :(得分:0)

我不知道您的参考文献是什么,但是您的样本中有很多东西表明它可能已过时。例如:不再使用用户名/密码凭据,而是需要IAM API密钥。代替工作区ID的是助手ID。

如果您使用Python和watson-developer-cloud pypi模块进行编写,则代码应类似于-https://cloud.ibm.com/apidocs/assistant-v2?code=python#send-user-input-to-assistant

import watson_developer_cloud

service = watson_developer_cloud.AssistantV2(
    iam_apikey='{apikey}',
    version='2018-11-08',
    url='{url}'
)

response = service.message(
    assistant_id='{assistant_id}',
    session_id='{session_id}',
    input={
        'message_type': 'text',
        'text': 'Hello'
    }
).get_result()

您的配置文件应提供apikeyurlassistant_id的值。您的代码将需要使用API​​来检索会话ID。