网络上的curl命令和对话框设计中的create_classifier操作有问题

时间:2019-01-03 06:14:33

标签: ibm-watson watson-conversation

我正在尝试使用Watson语言分类器操作。

似乎我需要先创建分类器。

要调用create_classifier动作,首先,我在终端上按动作入口点中的说明进行了尝试。

curl -u "username":"password" -X POST https://openwhisk.ng.bluemix.net/api/v1/namespaces/MY_ACCOUNT_dev/actions/natural-language-classifier-v1/create-classifier?blocking=true

失败。所以尝试了另一种方式,

curl -H "Content-Type: application/json" --data @params.json -u "username":"password" -X POST "https://openwhisk.ng.bluemix.net/api/v1/namespaces/MY_ACCOUNT_dev/actions/natural-language-classifier-v1/create-classifier?blocking=true"

params.json如下

{   
    "params":{
    "metadata":[{"language":"ko", "name":"test_classifier"}],
    "password": pw,
    "username": uname,
    "training_data":"weather_data_train.csv"
    }
}

这给了我"Insufficient credentials provided in constructor argument. Refer to the documentation for the required parameters. Common examples are username/password, api_key, and iam_access_token."条消息。

此外,尝试从Dialog GUI调用create_classifier。 响应定义如下

{
  "output": {
     "generic": [
     {
    "values": [],
    "response_type": "text",
    "selection_policy": "sequential"
    }
  ]
 },
  "actions": [
    {
     "name": "/MY_ACCOUNT_dev/actions/natural-language-classifier-v1/create-classifier",
     "type": "server",
     "parameters": {
        "text": "<? input.text ?>",
        "metadata": [
           {
           "name": "test_classifier",
           "language": "ko"
         }
       ],
    "password": password,
    "username": username,
    "training_data": "weather_data_train.csv"
   },
  "credentials": "$mycred",
  "result_variable": "context.classified_topic"
   }
 ]
}

得到{"error":"Unauthorized: Access is denied due to invalid credentials."}

除了操作入口点页面上显示的那些凭证以外,还有其他用于调用操作的凭证吗?

有人可以帮助我解决这个问题吗? 找不到与此相关的任何参考或文档。

0 个答案:

没有答案