watson-developer-cloud / python-sdk

:snake: Client library to use the IBM Watson services in Python and available in pip as watson-developer-cloud
https://pypi.org/project/ibm-watson/
Apache License 2.0
1.45k stars 828 forks source link

AssistantV2 - Unknown Error, code 404 #572

Closed jhoelzl closed 6 years ago

jhoelzl commented 6 years ago

Hello,

i am using Python 3.5.2 and i want to migrate from AssistantV1 to AssistantV2.

AssistantV1 with API Version "2018-09-20" works for me, so i tried the V2 example script (https://github.com/watson-developer-cloud/python-sdk/blob/master/examples/assistant_v2.py).

However, when i want to make an initial session, i always get this error:

Error: Unknown error, Code: 404 , X-dp-watson-tran-id: gateway02-2695223437 , X-global-transaction-id: ffea405d5bb6058ca0a5d88d".

Of course, i also changed the URL from https://gateway.watsonplatform.net/assistant/api' to https://gateway.watsonplatform.net/assistant/api/v2'.

My IBM Assistant Agents are hosted in UK.

Any suggestions? Regards, Josef

germanattanasio commented 6 years ago

Take a look at the example for Assistant V2 https://github.com/watson-developer-cloud/python-sdk/blob/master/examples/assistant_v2.py

The URL is https://gateway.watsonplatform.net/assistant/api. When in your code you use AssistantV2.

from watson_developer_cloud import AssistantV2

# If service instance provides API key authentication
# assistant = AssistantV2(
#     version='2017-04-21',
#     url='https://gateway.watsonplatform.net/assistant/api',
#     iam_apikey='iam_apikey')

assistant = AssistantV2(
    username='YOUR SERVICE USERNAME',
    password='YOUR SERVICE PASSWORD',
    url='https://gateway.watsonplatform.net/assistant/api',
    version='2017-04-21')
jhoelzl commented 6 years ago

Hi @germanattanasio , as stated in https://console.bluemix.net/docs/services/assistant/release-notes.html#releaseinformationen, the "only supported version" for AssistantV2 is 2018-09-20.

So, maybe the example code is not correct with version 2017-04-21.

jhoelzl commented 6 years ago

The problem is the line

session = assistant.create_session("<YOUR ASSISTANT ID>").get_result()

Here i replace <YOUR ASSISTANT ID> with my IBM workspace ID, but i always get:

exception": "Error: Unknown error, Code: 404 , X-dp-watson-tran-id: gateway02-3248073405 , X-global-transaction-id: ffea405d5bbc6710c199aabd"

germanattanasio commented 6 years ago

@jhoelzl the Assistant id is not the workspace id. Assistant v2 added new features like Agents and Skills. Make sure you read the documentation https://www.ibm.com/watson/developercloud/assistant/api/v2/curl.html?curl

jhoelzl commented 6 years ago

@germanattanasio thanks for this info. I have only an IBM Lite account, so i also created a new IBM Assistant Deployment (in UK), but i always get the "old version" with "workspaces / intents" instead of "assistants /skills". So i guess, this new feature is not fully deployed for all customers...

germanattanasio commented 6 years ago

It's in beta. From the tool you should be able to get the invite