Examples
Examples
Login
call dbsdk_v1.wx_logoutjob();call dbsdk_v1.wx_setapikeyforjob('x');call dbsdk_v1.wx_setprojectidforjob('y');
-- Should return Yvalues dbsdk_v1.wx_ShouldGetNewToken();
-- Should return Yvalues dbsdk_v1.wx_authenticate();
-- Should return Nvalues dbsdk_v1.wx_ShouldGetNewToken();
Generate
values dbsdk_v1.wx_generate('Hello world');values dbsdk_v1.wx_generate('Hello world', model_id => 'ibm/granite-3-8b-instruct');
model_id
corresponds to the model list returned bydbsdk_v1.GetModels()
.watsonx_generate()
has aparameters
parameter that can be used to control the generation, typically used by advanced users.
values dbsdk_v1.wx_parameters(temperature => 0.5, time_limit => 1000);values dbsdk_v1.wx_generate('Hello world', parameters => dbsdk_v1.parameters(temperature => 0.5, time_limit => 1000));
Infer
Coming soon.
Model list
Authorisation is not required to get the list of models.
call dbsdk_v1.wx_GetModels();
Installation
To install on IBM i, you need to clone this git repository onto an IBM i. You can do this with the following methods:
- use
git clone
on this repo - download the repo as a .zip from GitHub and extract it to your IBM i
Once the repo sources are in the IFS, then you can use GNU Make to build the SDK. GNU Make, gmake
, is available in yum. Read more on the IBM i OSS docs.
Everything will get built into the watsonx
repository.
cd /where/you/extracted/the/repogmake