Method failed with status code 404: Resource not found
我无法理解为什么我收到“资源未找到”错误。这是什么意思
from ibm_watson import AssistantV2, ApiException
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
authenticator = IAMAuthenticator('api correct')
assistant = AssistantV2(
version='2023-03-20',
authenticator=authenticator
)
assistant.set_service_url('used america dallas')
try:
session = assistant.create_session(
assistant_id='directly copied and pasted'
).get_result()
session_id = session['session_id']
response = assistant.message(
assistant_id='same here',
session_id=session_id,
input={
'message_type': 'text',
'text': 'Hello, how are you?'
}
).get_result()
print(response)
except ApiException as ex:
print("Method failed with status code " + str(ex.code) + ": " + ex.message)
我尝试通过它的 api 将它连接到 watson ai 并期望它的响应,但它总是给我资源错误
该错误与输入的信息不正确有关。您应该检查以下内容。
us-south
(您的达拉斯评论)assistant_id
是一个不同的值,具体取决于您在做什么。
environment_id
assistant_id
assistant_id
在示例代码中,您使用的是
message
,因此您应该使用 environment_id
。
要查找环境 ID,可以在 WA 的环境部分中找到。单击页面标题旁边的齿轮。
或者,如果您单击左下角的助手设置,您可以在那里进行所有设置。