Fixes watsonx branding & Adds software support

Signed-off-by: NoeSamaille <noe.samaille@ibm.com>
This commit is contained in:
NoeSamaille 2024-08-20 16:34:12 +02:00
parent 1f2a58e24e
commit 4cfece2b84
16 changed files with 139 additions and 244 deletions

View file

@ -79,6 +79,7 @@
"ollama": "^0.4.6",
"onnxruntime-node": "1.14.0",
"openai": "^4.20.1",
"p-limit": "^6.1.0",
"pg": "^8.11.3",
"posthog-node": "^3.6.3",
"quick-lru": "^7.0.0",

7
core/index.d.ts vendored
View file

@ -349,12 +349,9 @@ export interface LLMOptions {
projectId?: string;
capabilities?: ModelCapability;
// WatsonX options
// IBM watsonx options
watsonxUrl?: string;
watsonxApiKey?: string;
watsonxZenApiKeyBase64?: string; // Required if using watsonx software with ZenApiKey auth
watsonxUsername?: string;
watsonxPassword?: string;
watsonxCreds?: string;
watsonxProjectId?: string;
watsonxStopToken?: string;
}

View file

@ -111,13 +111,9 @@ export abstract class BaseLLM implements ILLM {
accountId?: string;
aiGatewaySlug?: string;
// For WatsonX only.
// For IBM watsonx only.
watsonxUrl?: string;
watsonxApiKey?: string;
watsonxZenApiKeyBase64?: string = "YOUR_WATSONX_ZENAPIKEY"; // Required if using watsonx software with ZenApiKey auth
watsonxUsername?: string;
watsonxPassword?: string;
watsonxCreds?: string;
watsonxProjectId?: string;
watsonxStopToken?: string;
@ -173,12 +169,11 @@ export abstract class BaseLLM implements ILLM {
this.apiKey = options.apiKey;
this.aiGatewaySlug = options.aiGatewaySlug;
this.apiBase = options.apiBase;
// for watsonx only
this.watsonxUrl = options.watsonxUrl;
this.watsonxApiKey = options.watsonxApiKey;
this.watsonxCreds = options.watsonxCreds;
this.watsonxProjectId = options.watsonxProjectId;
this.watsonxUsername = options.watsonxUsername;
this.watsonxPassword = options.watsonxPassword;
this.watsonxStopToken = options.watsonxStopToken;
if (this.apiBase && !this.apiBase.endsWith("/")) {

View file

@ -19,14 +19,14 @@ class WatsonX extends BaseLLM {
super(options);
}
async getBearerToken(): Promise<{ token: string; expiration: number }> {
if (
this.watsonxUrl !== null &&
this.watsonxUrl!.includes("cloud.ibm.com")
this.watsonxUrl?.includes("cloud.ibm.com")
) {
// watsonx SaaS
const wxToken = await (
await fetch(
`https://iam.cloud.ibm.com/identity/token?apikey=${this.watsonxApiKey}&grant_type=urn:ibm:params:oauth:grant-type:apikey`,
`https://iam.cloud.ibm.com/identity/token?apikey=${this.watsonxCreds}&grant_type=urn:ibm:params:oauth:grant-type:apikey`,
{
method: "POST",
headers: {
@ -42,18 +42,18 @@ class WatsonX extends BaseLLM {
};
} else {
// watsonx Software
console.log(this.watsonxCreds)
if (
this.watsonxZenApiKeyBase64 &&
this.watsonxZenApiKeyBase64 !== "YOUR_WATSONX_ZENAPIKEY"
!this.watsonxCreds?.includes(":")
) {
// Using ZenApiKey auth
return {
token: this.watsonxZenApiKeyBase64,
token: this.watsonxCreds ?? "",
expiration: -1,
};
} else {
// Using username/password auth
const userPass = this.watsonxCreds?.split(":")
const wxToken = await (
await fetch(`${this.watsonxUrl}/icp4d-api/v1/authorize`, {
method: "POST",
@ -62,8 +62,8 @@ class WatsonX extends BaseLLM {
Accept: "application/json",
},
body: JSON.stringify({
username: this.watsonxUsername,
password: this.watsonxPassword,
username: userPass[0],
password: userPass[1],
}),
})
).json();
@ -185,7 +185,7 @@ class WatsonX extends BaseLLM {
const stopToken =
this.watsonxStopToken ??
(options.model.includes("granite") ? "<|im_end|>" : undefined);
(options.model?.includes("granite") ? "<|im_end|>" : undefined);
var streamResponse = await fetch(
`${this.watsonxUrl}/ml/v1/text/generation_stream?version=2023-05-29`,
{

View file

@ -1,15 +1,38 @@
# Watsonx
# IBM watsonx
Watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.
watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.
## Setup
To access the Watsonx models, create an instance in the [IBM cloud](https://cloud.ibm.com) which supports watsonx studio. Then to create a project refer [this](https://www.ibm.com/docs/en/watsonx/saas?topic=projects-creating-project).
Accessing watsonx models can be done either through watsonx SaaS on IBM Cloud or using a dedicated watsonx Software software instance.
You can set it up in two different ways :
1. **Using API** : Create Your IBM cloud API key by referring [this](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=cli-creating-your-cloud-api-key).
2. **Using Credentials** : Use your Username and Password to authenticate
### watsonx.ai SaaS - IBM Cloud
To get started with watsonx SaaS, visit the [registration page](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx). If you do not have an existing IBM Cloud account, you can sign up for a free trial.
To authenticate to watsonx.ai SaaS with Continue, you will need to create a project and [setup an API key](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=cli-creating-your-cloud-api-key). Then, in continue:
- Set **watsonx URL** to your watsonx SaaS endpoint, e.g. `https://us-south.ml.cloud.ibm.com` for US South region.
- Set **watsonx Project ID** to your watsonx project ID.
- Set **watsonx Credentials** to your watsonx API Key.
### watsonx.ai Software
To authenticate to your watsonx.ai Software instance with Continue, you can use either `username/password` or `ZenApiKey` method:
1. *Option 1*: using username/password authentication:
- Set **watsonx URL** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`.
- Set **watsonx Project ID** to your watsonx project ID.
- Set **watsonx Credentials** to your watsonx Username and Password using `username:password` as format.
2. *Option 2*: using API Key authentication:
- Set **watsonx URL** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`.
- Set **watsonx Project ID** to your watsonx project ID.
- Set **watsonx Credentials** to your watsonx Zen API Key. To generate it:
1. Log in to the CPD web client.
2. From the toolbar, click your avatar.
3. Click **Profile and settings**.
4. Click **API key** > **Generate new key**.
5. Click **Generate**.
6. Click **Copy** and save your key somewhere safe. You cannot recover this key if you lose it.
7. Generate your ZenApiKey by running the following command in your preferred terminal: `echo "<username>:<apikey>" | base64`, replacing `<username>` with your CPD username and `<apikey>` with the API Key you just created.
## Usage
![usage-gif](../Model%20Providers/assets/Watsonx1.gif)
![usage-gif](../Model%20Providers/assets/Watsonx1.gif)

View file

@ -46,7 +46,7 @@ You can run a model on your local computer using:
- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples) (OpenAI compatible server)
- [IPEX-LLM](../reference/Model%20Providers/ipex_llm.md) (Local LLM on Intel GPU)
- [Msty](../reference/Model%20Providers/msty.md)
- [Watsonx](../reference/Model%20Providers/watsonx.md)
- [IBM watsonx](../reference/Model%20Providers/watsonx.md)
- [Nvidia NIMS](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
### Remote

View file

@ -216,7 +216,7 @@
"### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)",
"### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)",
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
"### Watsonx\nWatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
"### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)."
],
"type": "string"

View file

@ -216,7 +216,7 @@
"### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)",
"### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)",
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
"### Watsonx\nWatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
"### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)."
],
"type": "string"

View file

@ -216,7 +216,7 @@
"### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)",
"### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)",
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
"### Watsonx\nWatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
"### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)."
],
"type": "string"

View file

@ -219,7 +219,7 @@
"### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)",
"### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)",
"### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)",
"### Watsonx\nWatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
"### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.",
"### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)."
],
"type": "string"

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.197",
"version": "0.9.203",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.197",
"version": "0.9.203",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "0.9.197",
"version": "0.9.203",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -1,6 +1,6 @@
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import _ from "lodash";
import React, { useCallback, useContext, useEffect, useState } from "react";
import { useCallback, useContext, useEffect, useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { useDispatch } from "react-redux";
import { useNavigate, useParams } from "react-router-dom";
@ -14,7 +14,6 @@ import {
import StyledMarkdownPreview from "../../components/markdown/StyledMarkdownPreview";
import ModelCard from "../../components/modelSelection/ModelCard";
import ModelProviderTag from "../../components/modelSelection/ModelProviderTag";
import Toggle from "../../components/modelSelection/Toggle";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useNavigationListener } from "../../hooks/useNavigationListener";
import { setDefaultModel } from "../../redux/slices/stateSlice";
@ -65,35 +64,12 @@ function ConfigureProvider() {
undefined,
);
// different authentication flow is required for watsonx. This state helps to determine which flow to use for authentication
const [watsonxAuthenticate, setWatsonxAuthenticate] = React.useState(true);
useEffect(() => {
if (providerName) {
setModelInfo(providers[providerName]);
}
}, [providerName]);
const handleContinue = () => {
if (!modelInfo) return;
let formParams: any = {};
for (const d of modelInfo.collectInputFor || []) {
const val = formMethods.watch(d.key);
if (val === "" || val === undefined || val === null) continue;
formParams = updatedObj(formParams, {
[d.key]: d.inputType === "text" ? val : parseFloat(val),
});
}
const model = {
...formParams,
provider: modelInfo.provider,
};
ideMessenger.post("config/addModel", { model });
dispatch(setDefaultModel({ title: model.title, force: true }));
navigate("/");
};
const disableModelCards = useCallback(() => {
return (
modelInfo?.collectInputFor?.some((d) => {
@ -106,17 +82,6 @@ function ConfigureProvider() {
);
}, [modelInfo, formMethods]);
const enablecardsForApikey = useCallback(() => {
return modelInfo?.collectInputFor
?.filter((d) => d.isWatsonxAuthenticatedByApiKey)
.some((d) => !formMethods.watch(d.key));
}, [modelInfo, formMethods]);
const enablecardsForCredentials = useCallback(() => {
return modelInfo?.collectInputFor
?.filter((d) => d.isWatsonxAuthenticatedByCredentials)
.some((d) => !formMethods.watch(d.key));
}, [modelInfo, formMethods]);
return (
<FormProvider {...formMethods}>
<div className="overflow-y-scroll">
@ -161,112 +126,31 @@ function ConfigureProvider() {
/>
<br />
{/* The Watsonx Authentication coukd be done by two different ways
1 ==> Using Api key
2 ==> Using Credentials */}
{providerName === "watsonx" ? (
{(modelInfo?.collectInputFor?.filter((d) => d.required).length || 0) >
0 && (
<>
<div className="col-span-full py-4">
<Toggle
selected={watsonxAuthenticate}
optionOne={"Authenticate by API key"}
optionTwo={"Authenticate by crendentials"}
onClick={() => {
setWatsonxAuthenticate((prev) => !prev);
}}
></Toggle>
</div>
{watsonxAuthenticate ? (
<>
{(modelInfo?.collectInputFor?.filter((d) => d.required)
.length || 0) > 0 && (
<>
<h3 className="mb-2">Enter required parameters</h3>
<h3 className="mb-2">Enter required parameters</h3>
{modelInfo?.collectInputFor
.filter((d) => d.isWatsonxAuthenticatedByApiKey)
.map((d, idx) => (
<div key={idx} className="mb-2">
<label htmlFor={d.key}>{d.label}</label>
<Input
type={d.inputType}
id={d.key}
className="border-2 border-gray-200 rounded-md p-2 m-2"
placeholder={d.placeholder}
defaultValue={d.defaultValue}
min={d.min}
max={d.max}
step={d.step}
{...formMethods.register(d.key, {
required: false,
})}
/>
</div>
))}
</>
)}
</>
) : (
<>
{(modelInfo?.collectInputFor?.filter((d) => d.required)
.length || 0) > 0 && (
<>
<h3 className="mb-2">Enter required parameters</h3>
{modelInfo?.collectInputFor
.filter((d) => d.isWatsonxAuthenticatedByCredentials)
.map((d, idx) => (
<div key={idx} className="mb-2">
<label htmlFor={d.key}>{d.label}</label>
<Input
type={d.inputType}
id={d.key}
className="border-2 border-gray-200 rounded-md p-2 m-2"
placeholder={d.placeholder}
defaultValue={d.defaultValue}
min={d.min}
max={d.max}
step={d.step}
{...formMethods.register(d.key, {
required: true,
})}
/>
</div>
))}
</>
)}
</>
)}
</>
) : (
<>
{(modelInfo?.collectInputFor?.filter((d) => d.required).length ||
0) > 0 && (
<>
<h3 className="mb-2">Enter required parameters</h3>
{modelInfo?.collectInputFor
?.filter((d) => d.required)
.map((d, idx) => (
<div key={idx} className="mb-2">
<label htmlFor={d.key}>{d.label}</label>
<Input
type={d.inputType}
id={d.key}
className="border-2 border-gray-200 rounded-md p-2 m-2"
placeholder={d.placeholder}
defaultValue={d.defaultValue}
min={d.min}
max={d.max}
step={d.step}
{...formMethods.register(d.key, {
required: true,
})}
/>
</div>
))}
</>
)}
{modelInfo?.collectInputFor
?.filter((d) => d.required)
.map((d, idx) => (
<div key={idx} className="mb-2">
<label htmlFor={d.key}>{d.label}</label>
<Input
type={d.inputType}
id={d.key}
className="border-2 border-gray-200 rounded-md p-2 m-2"
placeholder={d.label}
defaultValue={d.defaultValue}
min={d.min}
max={d.max}
step={d.step}
{...formMethods.register(d.key, {
required: true,
})}
/>
</div>
))}
</>
)}
@ -276,9 +160,8 @@ function ConfigureProvider() {
<summary className="mb-2 cursor-pointer">
<b>Advanced (optional)</b>
</summary>
{modelInfo?.collectInputFor?.map((d, idx) => {
// Check the attribute is only for Watson X
if (d.isWatsonxAttribute) return null;
if (d.required) return null;
return (
<div key={idx}>
@ -287,7 +170,7 @@ function ConfigureProvider() {
type={d.inputType}
id={d.key}
className="border-2 border-gray-200 rounded-md p-2 m-2"
placeholder={d.placeholder}
placeholder={d.label}
defaultValue={d.defaultValue}
min={d.min}
max={d.max}
@ -309,11 +192,7 @@ function ConfigureProvider() {
return (
<ModelCard
key={idx}
disabled={
disableModelCards() &&
enablecardsForApikey() &&
enablecardsForCredentials()
}
disabled={disableModelCards()}
title={pkg.title}
description={pkg.description}
tags={pkg.tags}
@ -321,12 +200,7 @@ function ConfigureProvider() {
icon={pkg.icon || modelInfo.icon}
dimensions={pkg.dimensions}
onClick={(e, dimensionChoices) => {
if (
disableModelCards() &&
enablecardsForApikey() &&
enablecardsForCredentials()
)
return;
if (disableModelCards()) return;
let formParams: any = {};
for (const d of modelInfo.collectInputFor || []) {
const val = formMethods.watch(d.key);

View file

@ -722,7 +722,7 @@ export const models: { [key: string]: ModelPackage } = {
isOpenSource: false,
},
graniteChat: {
title: "Watsonx - Granite Chat",
title: "watsonx - Granite Chat",
description:
"The Granite model series is a family of IBM-trained, dense decoder-only models, which are particularly well-suited for generative tasks.",
params: {
@ -735,38 +735,38 @@ export const models: { [key: string]: ModelPackage } = {
isOpenSource: false,
},
graniteCode: {
title: "Watsonx - Granite Code",
title: "watsonx - Granite Code 20b",
description:
"The Granite model series is a family of IBM-trained, dense decoder-only models, which are particularly well-suited for generative tasks.",
params: {
model: "ibm/granite-20b-code-instruct",
contextLength: 20_000,
title: "Granite Code"
title: "watsonx - Granite Code 20b"
},
providerOptions: ["watsonx"],
icon: "Watsonx.png",
icon: "watsonx.png",
isOpenSource: false,
},
MistralLarge: {
title: "Watsonx - Mistral",
title: "watsonx - Mistral Large",
description:
"Mistral Large, the most advanced Large Language Model (LLM) developed by Mistral Al, is an exceptionally powerful model.",
params: {
model: "mistralai/mistral-large",
contextLength: 20_000,
title: "Watsonx - Mistral",
title: "watsonx - Mistral Large",
},
providerOptions: ["watsonx"],
icon: "mistral.png",
isOpenSource: false,
},
MetaLlama3: {
title: "Meta Llama 3",
title: "watsonx - Llama 3.1",
description:
"Llama 3 is an auto-regressive language model that uses an optimized transformer architecture.",
params: {
title: "Meta-llama3-8b",
model: "meta-llama/llama-3-8b-instruct",
title: "watsonx - Llama 3.1 8b",
model: "meta-llama/llama-3-1-8b-instruct",
contextLength: 20_000,
},
icon: "meta.png",
@ -776,12 +776,12 @@ export const models: { [key: string]: ModelPackage } = {
description: "The number of parameters in the model",
options: {
"8b": {
model: "meta-llama/llama-3-8b-instruct",
title: "Meta-llama3-8b",
model: "meta-llama/llama-3-1-8b-instruct",
title: "watsonx - Llama 3.1 8b",
},
"70b": {
model: "meta-llama/llama-3-70b-instruct",
title: "Meta-llama3-70b",
model: "meta-llama/llama-3-1-70b-instruct",
title: "watsonx - Llama 3.1 70b",
},
},
},

View file

@ -19,11 +19,6 @@ export interface InputDescriptor {
required?: boolean;
description?: string;
[key: string]: any;
// the following are used only for Watsonx provider
// these attributes are used to determine whether the input is used in Api Authentication or Credentials section
isWatsonxAuthenticatedByApiKey?: boolean;
isWatsonxAuthenticatedByCredentials?: boolean;
isWatsonxAttribute?: boolean;
}
export interface ProviderInfo {
@ -481,54 +476,64 @@ After it's up and running, you can start using Continue.`,
],
},
watsonx: {
title: "Watsonx",
title: "IBM watsonx",
provider: "watsonx",
refPage: "watsonX",
description:
"Explore foundation models from IBM and other third-parties depending on your use case.",
longDescription: `Watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.`,
longDescription: `**watsonx**, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.
### Setup
Accessing watsonx models can be done either through watsonx SaaS on IBM Cloud or using a dedicated watsonx Software software instance.
#### watsonx.ai SaaS (IBM Cloud)
To get started with watsonx SaaS, visit the [registration page](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx). If you do not have an existing IBM Cloud account, you can sign up for a free trial.
To authenticate to watsonx.ai SaaS with Continue, you will need to create a project and [setup an API key](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=cli-creating-your-cloud-api-key). Then, in continue:
- Set **watsonx URL** to your watsonx SaaS endpoint, e.g. \`https://us-south.ml.cloud.ibm.com\` for US South region.
- Set **watsonx Project ID** to your watsonx project ID.
- Set **watsonx Credentials** to your watsonx API Key.
#### watsonx.ai Software
To authenticate to your watsonx.ai Software instance with Continue, you can use either \`username/password\` or \`ZenApiKey\` method:
1. *Option 1*: using username/password authentication:
- Set **watsonx URL** to your watsonx software endpoint, e.g. \`https://cpd-watsonx.apps.example.com\`.
- Set **watsonx Project ID** to your watsonx project ID.
- Set **watsonx Credentials** to your watsonx Username and Password using \`username:password\` as format.
2. *Option 2*: using API Key authentication:
- Set **watsonx URL** to your watsonx software endpoint, e.g. \`https://cpd-watsonx.apps.example.com\`.
- Set **watsonx Project ID** to your watsonx project ID.
- Set **watsonx Credentials** to your watsonx Zen API Key. To generate it:
1. Log in to the CPD web client.
2. From the toolbar, click your avatar.
3. Click **Profile and settings**.
4. Click **API key** > **Generate new key**.
5. Click **Generate**.
6. Click **Copy** and save your key somewhere safe. You cannot recover this key if you lose it.
7. Generate your ZenApiKey by running the following command in your preferred terminal: \`echo "<username>:<apikey>" | base64\`, replacing \`<username>\` with your CPD username and \`<apikey>\` with the API Key you just created.`,
collectInputFor: [
{
inputType: "text",
key: "watsonxUrl",
label: "Watsonx URL",
label: "watsonx URL",
placeholder: "http://<region>.dataplatform.cloud.ibm.com",
required: true,
isWatsonxAuthenticatedByApiKey: true,
isWatsonxAuthenticatedByCredentials: true,
},
{
inputType: "text",
key: "watsonxApiKey",
label: "Watsonx API Key",
placeholder: "Enter your API key",
required: true,
isWatsonxAuthenticatedByApiKey: true,
required: true
},
{
inputType: "text",
key: "watsonxProjectId",
label: "Watsonx Project Id",
placeholder: "Enter your project Id",
required: true,
isWatsonxAuthenticatedByApiKey: true,
isWatsonxAuthenticatedByCredentials: true,
label: "watsonx Project ID",
placeholder: "Enter your project ID",
required: true
},
{
inputType: "text",
key: "watsonxUsername",
label: "Watsonx Username",
placeholder: "Enter your Username",
required: true,
isWatsonxAuthenticatedByCredentials: true,
},
{
inputType: "text",
key: "watsonxPassword",
label: "Watsonx Password",
placeholder: "Enter your password",
required: true,
isWatsonxAuthenticatedByCredentials: true,
key: "watsonxCreds",
label: "watsonx Credentials",
placeholder: "Enter your Apikey, ZenApikey, or username:password",
required: true
},
{
inputType: "text",
@ -553,7 +558,7 @@ After it's up and running, you can start using Continue.`,
...completionParamsInputsConfigs,
],
icon: "Watsonx.png",
icon: "watsonx.png",
tags: [ModelProviderTags.RequiresApiKey],
packages: [
models.graniteCode,