diff --git a/binary/package-lock.json b/binary/package-lock.json index 9378d2eef..b57800a29 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -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", diff --git a/core/index.d.ts b/core/index.d.ts index 1dc806f88..8c78760a8 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -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; } diff --git a/core/llm/index.ts b/core/llm/index.ts index 73a0151e9..adacc2222 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -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("/")) { diff --git a/core/llm/llms/WatsonX.ts b/core/llm/llms/WatsonX.ts index 5a18ab932..226ac0803 100644 --- a/core/llm/llms/WatsonX.ts +++ b/core/llm/llms/WatsonX.ts @@ -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`, { diff --git a/docs/docs/reference/Model Providers/watsonx.md b/docs/docs/reference/Model Providers/watsonx.md index b6a239946..c52c5bb79 100644 --- a/docs/docs/reference/Model Providers/watsonx.md +++ b/docs/docs/reference/Model Providers/watsonx.md @@ -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 ":" | base64`, replacing `` with your CPD username and `` with the API Key you just created. ## Usage -![usage-gif](../Model%20Providers/assets/Watsonx1.gif) \ No newline at end of file +![usage-gif](../Model%20Providers/assets/Watsonx1.gif) diff --git a/docs/docs/setup/model-providers.md b/docs/docs/setup/model-providers.md index ab774d242..7fa740db4 100644 --- a/docs/docs/setup/model-providers.md +++ b/docs/docs/setup/model-providers.md @@ -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 diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index f6611bea0..1c2f426f0 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -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" diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index f6611bea0..1c2f426f0 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -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" diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index f6611bea0..1c2f426f0 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -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" diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 5bcfaa05c..e806bf238 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -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" diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 6af742e21..fb5febd1d 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -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", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 389c6bac5..716a970ee 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -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" diff --git a/gui/public/logos/WatsonX.png b/gui/public/logos/WatsonX.png index 66cf02a03..ba4807267 100644 Binary files a/gui/public/logos/WatsonX.png and b/gui/public/logos/WatsonX.png differ diff --git a/gui/src/pages/AddNewModel/ConfigureProvider.tsx b/gui/src/pages/AddNewModel/ConfigureProvider.tsx index b46db1931..28a60f9ab 100644 --- a/gui/src/pages/AddNewModel/ConfigureProvider.tsx +++ b/gui/src/pages/AddNewModel/ConfigureProvider.tsx @@ -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 (
@@ -161,112 +126,31 @@ function ConfigureProvider() { />
- {/* 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 && ( <> -
- { - setWatsonxAuthenticate((prev) => !prev); - }} - > -
- {watsonxAuthenticate ? ( - <> - {(modelInfo?.collectInputFor?.filter((d) => d.required) - .length || 0) > 0 && ( - <> -

Enter required parameters

+

Enter required parameters

- {modelInfo?.collectInputFor - .filter((d) => d.isWatsonxAuthenticatedByApiKey) - .map((d, idx) => ( -
- - -
- ))} - - )} - - ) : ( - <> - {(modelInfo?.collectInputFor?.filter((d) => d.required) - .length || 0) > 0 && ( - <> -

Enter required parameters

- - {modelInfo?.collectInputFor - .filter((d) => d.isWatsonxAuthenticatedByCredentials) - .map((d, idx) => ( -
- - -
- ))} - - )} - - )} - - ) : ( - <> - {(modelInfo?.collectInputFor?.filter((d) => d.required).length || - 0) > 0 && ( - <> -

Enter required parameters

- - {modelInfo?.collectInputFor - ?.filter((d) => d.required) - .map((d, idx) => ( -
- - -
- ))} - - )} + {modelInfo?.collectInputFor + ?.filter((d) => d.required) + .map((d, idx) => ( +
+ + +
+ ))} )} @@ -276,9 +160,8 @@ function ConfigureProvider() { Advanced (optional) + {modelInfo?.collectInputFor?.map((d, idx) => { - // Check the attribute is only for Watson X - if (d.isWatsonxAttribute) return null; if (d.required) return null; return (
@@ -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 ( { - if ( - disableModelCards() && - enablecardsForApikey() && - enablecardsForCredentials() - ) - return; + if (disableModelCards()) return; let formParams: any = {}; for (const d of modelInfo.collectInputFor || []) { const val = formMethods.watch(d.key); diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index 1c7756e3d..4763f77ff 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -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", }, }, }, diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 4d83876ba..40c010022 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -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 ":" | base64\`, replacing \`\` with your CPD username and \`\` with the API Key you just created.`, collectInputFor: [ { inputType: "text", key: "watsonxUrl", - label: "Watsonx URL", + label: "watsonx URL", placeholder: "http://.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,