continue-watsonx
continue-watsonx copied to clipboard
CustomLLM config to leverage watsonx LLMs with continue.dev.
watsonx CustomLLM definition for Continue
Simple CustomLLM definition to leverage IBM watsonx LLMs on Continue extentions.
Note: watsonx is now available natively as a provider in continue !

Features
- [x] Support watsonx.ai SaaS.
- [x] Support streaming of response.
- [x] Support
granite-34b-code-instruct. - [x] Bearer token rotation.
- [x] Custom prompt template for Granite.
- [x] Support watsonx.ai Software.
- [x] Support non-granite LLMs.
- [ ] Create separate Chat and Completion models.
Get started (~ 2min)
- Install Continue extension (tested with VSCode extension).
- Clone this reposiroty in your
~/.continue/directorycd ~/.continue/ git clone https://github.com/NoeSamaille/continue-watsonx.git - Make a local copy of your local Continue config:
mv ~/.continue/config.ts ~/.continue/config-backup.ts - Copy the provided
config-sample.tsto replace~/.continue/config.ts:
or, if you have customized yourcp ~/.continue/continue-watsonx/src/config-sample.ts ~/.continue/config.tsconfig.ts, manually add the code to load theWatsonxmodule and useWatsonx.addConfig():import {watsonx_modifyConfig} from "./continue-watsonx/src/watsonx"; export function modifyConfig(config: Config): Config { return watsonx_modifyConfig(config); } - Copy
src/watsonxenv.ts.sampletosrc/watsonxenv.tsand updateWatsonxEnvwith your target configuration:cp ~/.continue/continue-watsonx/src/watsonxenv.ts.sample ~/.continue/continue-watsonx/src/watsonxenv.ts- If using watsonx SaaS:
- Replace
YOUR_WATSONX_URLwith your watsonx SaaS endpoint, e.g.https://us-south.ml.cloud.ibm.comfor US South region. - Replace
YOUR_WATSONX_APIKEYwith your watsonx API Key. - Replace
YOUR_WATSONX_PROJECT_IDwith your watsonx project ID.
- Replace
- If using watsonx software:
- Option 1: using username/password authentication:
- Replace
YOUR_WATSONX_URLwith your watsonx software endpoint, e.g.https://cpd-watsonx.apps.example.com. - Replace
YOUR_WATSONX_USERNAMEwith your watsonx username, e.g.cpadmin. - Replace
YOUR_WATSONX_PASSWORDwith your watsonx password. - Replace
YOUR_WATSONX_PROJECT_IDwith your watsonx project ID.
- Replace
- Option 2: using API Key authentication:
- Replace
YOUR_WATSONX_URLwith your watsonx software endpoint, e.g.https://cpd-watsonx.apps.example.com. - Replace
YOUR_WATSONX_ZENAPIKEYwith your watsonx Zen API Key. To generate it:- Log in to the CPD web client.
- From the toolbar, click your avatar.
- Click Profile and settings.
- Click API key > Generate new key.
- Click Generate.
- Click Copy and save your key somewhere safe. You cannot recover this key if you lose it.
- Generate your ZenApiKey by running the following command:
echo "<username>:<apikey>" | base64, replacing<username>with your CPD username and<apikey>with the API Key you just created.
- Replace
YOUR_WATSONX_PROJECT_IDwith your watsonx project ID.
- Replace
- Option 1: using username/password authentication:
-
-
Note: if using watsonx software instance with self-signed/untrusted TLS certificates, uncomment the following lines in
~/.continue/continue-watsonx/src/watsonx.tsto bypass SSL certificate verification:declare var process : { env: { NODE_TLS_REJECT_UNAUTHORIZED: any } } process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
-
- Optionally, update
modelsto comment/uncomment/edit model list based on LLMs deployed in your watsonx instance.
- If using watsonx SaaS:
- Enjoy!
Contributors
- @NoeSamaille
- @remiserra