Setting up watsonx Code Assistant for Z in IBM Cloud
watsonx Code Assistant for Z
As a cloud administrator, you must generate an API key to connect the service with a deployment space through IBM Cloud. After you set up your environment, your users can enable Visual Studio Code to interact with watsonx Code Assistant for Z.
Before you begin
-
Make sure that you have an IBM Cloud account.
-
Provision an instance of watsonx Code Assistant through the IBM Cloud catalog page or by working with an IBM sales representative.
-
Download the
IBM watsonx Code Assistant for Z 2.0 Multiplatform Multilingual eAssembly
from IBM Passport Advantage.
When you finish provisioning your instance, click Setup to open an onboarding checklist page to help you configure the instance. Or, you can select Administration and then Setup to access this onboarding checklist.
Items in that checklist correspond to each of the following steps. Click the action arrows on the checklist page that are associated with each item to complete the steps.
Create a service ID and API key
You can use this API key later to enable Visual Studio Code to communicate with watsonx Code Assistant.
-
On the Service IDs page, click Create.
-
Enter
IBM watsonx Code Assistant user
as the name for your service ID. Optionally, enter a description. -
Click Create.
You are redirected to the dashboard for your service ID, which includes tabs for Access and API keys.
-
Click the API Keys tab.
-
Click Create.
-
Enter
IBM watsonx Code Assistant API key
as the name for your API key. Optionally, enter a description. -
Click Create.
-
Click Download or Copy and store the API key in a safe location.
The key is only available for 296 seconds. Make sure to store it somewhere you can find it later.
Although watsonx Code Assistant supports allowing multiple users to share the API key for the Service ID, the best practice is for each user to have their own API key. For more information about adding users to your instance, see Managing IAM access for watsonx Code Assistant for Z.
Create a deployment space
The deployment space is the serving environment for watsonx Code Assistant.
-
In your watsonx Code Assistant instance, click the Navigation Menu icon
, then select Deployments.
-
Click New deployment space.
-
Enter
Code Assistant
as the name for your deployment space. Optionally, enter a description. -
In Code assistant service, select your instance.
-
Click Create.
-
A status window appears. After the space is created, click Close.
Add the service ID as a space collaborator
Enable the API to connect to your deployment space.
-
On the Manage tab of your deployment space, click Access control.
-
Click Add collaborators and select Add service IDs from the menu.
A list of service IDs that are associated with your account appears.
-
Click the checkbox for the IBM watsonx Code Assistant user service ID that you created, and select Editor for the role.
-
Click Add.
The service ID is added to the list of collaborators.
Sign up for Db2
Watsonx Code Assistant for Z uses Db2 to store code input and output. If you don't already have an instance of Db2, IBM Cloud can help you create one that is optimized for watsonx Code Assistant for Z.
-
Select a region from the list of available regions.
-
Review the preselected Db2 pricing plan.
-
Click Create.
Add the Db2 connection to your space
Enable the deployment space to send and retrieve code from Db2 storage.
-
On the Assets tab of your deployment space, click Import assets.
-
Click Data access, then click Connection.
-
Click To service.
-
Select your Db2 service instance and click Select.
A Create connection: IBM Db2 on Cloud panel appears with prepopulated information from your service instance.
-
Click Create.
If you did not set a location and sovereignty, a window appears where you can confirm that you want to create the connection without setting these values. To accept, click Create. If you need to set the values, click Cancel and select Location and sovereignty.
If your database is on another IBM Cloud account, or if the automated population fails, see Why can't I connect watsonx Code Assistant for Z to my Db2 database?.
Set up the Db2 database
After watsonx Code Assistant for Z is set up in IBM Cloud, the Db2 administrator needs to configure the database by loading the provided script.
To locate the script files:
-
Use IBM Passport Advantage to download either:
- The complete
IBM watsonx Code Assistant for Z 2.0 Multiplatform Multilingual eAssembly
- Or the individual image
IBM watsonx Code Assistant Developer Tools 2.0 Multilingual
- The complete
-
Open the
IBM watsonx Code Assistant Developer Tools 2.0 Multilingual
image.(The compressed file name is
IwCAfZ2e0_2.0_ML.zip
.) -
In the
IBM watsonx Code Assistant Developer Tools 2.0 Multilingual
folder, open the compressed filewatsonx_Code_Assistant-for_Z-2.0.0.zip
. -
Locate these files in the
watsonx_Code_Assistant-for_Z-2.0.0
folder:adscan_DB2oC_CreateObjects.sql
adscan_DB2oC_DeleteObjects.sql
To configure Db2:
-
In the Db2 on Cloud console, click the Run SQL
icon.
-
Click the plus (+) tab to add a script.
-
If you already have an initialized database from a previous version of watsonx Code Assistant for Z, you need first clean up the old database. Click From file and browse to select
adscan_DB2oC_DeleteObjects.sql
, then click Run all to delete the schema and tables. -
To initialize a new database, click From file and browse to select
adscan_DB2oC_CreateObjects.sql
. -
Click Run all to create the schema and tables.
Next steps
You deployed and connected your IBM Cloud components to your provisioned watsonx Code Assistant instance. You're ready to take your next steps and integrate with your IBM Z Open Editor in Visual Studio Code. For information, see Set up a development environment.