ibm_watson_machine_learning
For information on how to start working with IBM watsonx.ai for IBM Cloud, refer toGetting started with Cloud Pak for Data as a Service.
For a list of supported machine learning frameworks (models) on IBM watsonx.ai for IBM Cloud, refer toSupported frameworks and software specifications.
To use watsonx.ai APIs, create an instance of APIClient with authentication details.
Note: Depending on the region of your provisioned service instance, use one of the following as your URL:
Dallas:
https://us-south.ml.cloud.ibm.com
Frankfurt:
https://eu-de.ml.cloud.ibm.com
London:
https://eu-gb.ml.cloud.ibm.com
Sydney:
https://au-syd.ml.cloud.ibm.com
(supported in1.1.23
and newer)Tokyo:
https://jp-tok.ml.cloud.ibm.com
Toronto:
https://ca-tor.ml.cloud.ibm.com
(supported in1.2.1
and newer)Mumbai (AWS):
https://ap-south-1.aws.wxai.ibm.com
(supported in1.3.26
and newer)
Note: To determine yourapi_key, refer toIBM Cloud console API keys.
Example of creating the client using an API key:
fromibm_watsonx_aiimportAPIClientfromibm_watsonx_aiimportCredentialscredentials=Credentials(url="https://us-south.ml.cloud.ibm.com",api_key=IAM_API_KEY)client=APIClient(credentials)
Example of creating the client using a token:
fromibm_watsonx_aiimportAPIClientfromibm_watsonx_aiimportCredentialscredentials=Credentials(url="https://us-south.ml.cloud.ibm.com",token="***********",)client=APIClient(credentials)
Note: Setting a default space ID or project ID is mandatory. For details, refer to theclient.set.default_space()
API in this document.
Hint
You can copy the project_id from the Project’s Manage tab (Project -> Manage -> General -> Details).
MCSP AWS uses the same authentication method as standard IBM Cloud environment:
fromibm_watsonx_aiimportAPIClientfromibm_watsonx_aiimportCredentialscredentials=Credentials(url="https://ap-south-1.aws.wxai.ibm.com",# MCSP AWS urlapi_key=IAM_API_KEY# api key generated from MCSP AWS UI)client=APIClient(credentials)
Although the above setup is sufficient for most environments, environments behind a firewall may need an additional adjustment.The following endpoints are used byibm-watsonx-ai
and need to be whitelisted to ensure correct functioning of the module:
https://au-syd.ml.cloud.ibm.comhttps://ca-tor.ml.cloud.ibm.comhttps://eu-de.ml.cloud.ibm.comhttps://eu-gb.ml.cloud.ibm.comhttps://jp-tok.ml.cloud.ibm.comhttps://us-south.ml.cloud.ibm.comhttps://api.au-syd.dai.cloud.ibm.comhttps://api.ca-tor.dai.cloud.ibm.comhttps://api.dataplatform.cloud.ibm.comhttps://api.eu-de.dataplatform.cloud.ibm.comhttps://api.eu-gb.dataplatform.cloud.ibm.comhttps://api.jp-tok.dataplatform.cloud.ibm.comhttps://iam.cloud.ibm.com
MCSP AWS:.. code-block:
https://ap-south-1.aws.wxai.ibm.comhttps://api.ap-south-1.aws.data.ibm.comhttps://account-iam.platform.saas.ibm.com