updated watsonx support

This commit is contained in:
Nate Sesti 2024-08-02 09:49:46 -07:00
parent 26b6e71077
commit 8202ded2b7
7 changed files with 341 additions and 315 deletions

View file

@ -4,67 +4,78 @@ import {
LLMOptions,
ModelProvider,
} from "../../index.js";
import { stripImages } from "../countTokens.js";
import { stripImages } from "../images.js";
import { BaseLLM } from "../index.js";
const watsonxConfig = {
accessToken: {
expiration: 0,
token: ""
}
token: "",
},
};
class WatsonX extends BaseLLM {
protected maxStopWords: number | undefined = undefined;
constructor(options: LLMOptions) {
super(options);
}
async getBearerToken(): Promise<{ token: string, expiration: number }> {
async getBearerToken(): Promise<{ token: string; expiration: number }> {
if (this.watsonxUrl != null && 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`, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json"
}
})).json();
const wxToken = await (
await fetch(
`https://iam.cloud.ibm.com/identity/token?apikey=${this.watsonxApiKey}&grant_type=urn:ibm:params:oauth:grant-type:apikey`,
{
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json",
},
},
)
).json();
return {
token: wxToken["access_token"],
expiration: wxToken["expiration"]
expiration: wxToken["expiration"],
};
} else {
// watsonx Software
if (this.watsonxZenApiKeyBase64 && this.watsonxZenApiKeyBase64 !== "YOUR_WATSONX_ZENAPIKEY") {
if (
this.watsonxZenApiKeyBase64 &&
this.watsonxZenApiKeyBase64 !== "YOUR_WATSONX_ZENAPIKEY"
) {
// Using ZenApiKey auth
return {
token: this.watsonxZenApiKeyBase64,
expiration: -1
expiration: -1,
};
} else {
// Using username/password auth
const wxToken = await (await fetch(`${this.watsonxUrl}/icp4d-api/v1/authorize`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
body: JSON.stringify({
"username": this.watsonxUsername,
"password": this.watsonxPassword
const wxToken = await (
await fetch(`${this.watsonxUrl}/icp4d-api/v1/authorize`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
username: this.watsonxUsername,
password: this.watsonxPassword,
}),
})
})).json();
const wxTokenExpiry = await (await fetch(`${this.watsonxUrl}/usermgmt/v1/user/tokenExpiry`, {
method: "GET",
headers: {
"Accept": "application/json",
"Authorization": `Bearer ${wxToken["token"]}`
}
})).json();
).json();
const wxTokenExpiry = await (
await fetch(`${this.watsonxUrl}/usermgmt/v1/user/tokenExpiry`, {
method: "GET",
headers: {
Accept: "application/json",
Authorization: `Bearer ${wxToken["token"]}`,
},
})
).json();
return {
token: wxToken["token"],
expiration: wxTokenExpiry["exp"]
expiration: wxTokenExpiry["exp"],
};
}
}
@ -114,7 +125,7 @@ class WatsonX extends BaseLLM {
protected _getHeaders() {
return {
"Content-Type": "application/json",
"Authorization": `${watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"} ${watsonxConfig.accessToken.token}`
Authorization: `${watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"} ${watsonxConfig.accessToken.token}`,
};
}
@ -149,43 +160,55 @@ class WatsonX extends BaseLLM {
messages: ChatMessage[],
options: CompletionOptions,
): AsyncGenerator<ChatMessage> {
var now = (new Date()).getTime() / 1000;
if (watsonxConfig.accessToken === undefined || now > watsonxConfig.accessToken.expiration || watsonxConfig.accessToken.token === undefined) {
var now = new Date().getTime() / 1000;
if (
watsonxConfig.accessToken === undefined ||
now > watsonxConfig.accessToken.expiration ||
watsonxConfig.accessToken.token === undefined
) {
watsonxConfig.accessToken = await this.getBearerToken();
} else {
console.log(`Reusing token (expires in ${(watsonxConfig.accessToken.expiration - now) / 60} mins)`);
console.log(
`Reusing token (expires in ${(watsonxConfig.accessToken.expiration - now) / 60} mins)`,
);
}
if (watsonxConfig.accessToken.token === undefined) {
throw new Error(`Something went wrong. Check your credentials, please.`);
}
var streamResponse = await fetch(`${this.watsonxUrl}/ml/v1/text/generation_stream?version=2023-05-29`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `${watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"} ${watsonxConfig.accessToken.token}`
},
body: JSON.stringify({
"input": messages[messages.length - 1].content,
"parameters": {
"decoding_method": "greedy",
"max_new_tokens": options.maxTokens ?? 1024,
"min_new_tokens": 1,
"stop_sequences": [],
"repetition_penalty": 1
var streamResponse = await fetch(
`${this.watsonxUrl}/ml/v1/text/generation_stream?version=2023-05-29`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `${watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"} ${watsonxConfig.accessToken.token}`,
},
"model_id": options.model,
"project_id": this.watsonxProjectId
})
});
body: JSON.stringify({
input: messages[messages.length - 1].content,
parameters: {
decoding_method: "greedy",
max_new_tokens: options.maxTokens ?? 1024,
min_new_tokens: 1,
stop_sequences: [],
repetition_penalty: 1,
},
model_id: options.model,
project_id: this.watsonxProjectId,
}),
},
);
if (!streamResponse.ok || streamResponse.body === null) {
throw new Error("Something went wrong. No response received, check your connection");
}
else {
throw new Error(
"Something went wrong. No response received, check your connection",
);
} else {
const reader = streamResponse.body.getReader();
while (true) {
const chunk = await reader.read();
if (chunk.done) { break; }
if (chunk.done) {
break;
}
// Decode the stream
const textResponseMsg = new TextDecoder().decode(chunk.value);
@ -197,7 +220,9 @@ class WatsonX extends BaseLLM {
// console.log(`${el}`);
if (el.startsWith("id:")) {
generatedTextIndex = parseInt(el.replace(/^id:\s+/, ""));
if (isNaN(generatedTextIndex)) { console.error(`Unable to parse stream chunk ID: ${el}`); }
if (isNaN(generatedTextIndex)) {
console.error(`Unable to parse stream chunk ID: ${el}`);
}
} else if (el.startsWith("data:")) {
const dataStr = el.replace(/^data:\s+/, "");
try {
@ -214,11 +239,11 @@ class WatsonX extends BaseLLM {
generatedChunk = generatedChunk.replaceAll("<|im_start|> ", "\n");
yield {
role: "assistant",
content: (generatedChunk),
content: generatedChunk,
};
}
}
}
}
export default WatsonX;
export default WatsonX;

View file

@ -187,7 +187,8 @@
"cloudflare",
"deepseek",
"azure",
"msty"
"msty",
"watsonx"
],
"markdownEnumDescriptions": [
"### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)",
@ -211,7 +212,8 @@
"### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)",
"### 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)"
"### 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."
],
"type": "string"
},
@ -1185,6 +1187,48 @@
}
}
}
},
{
"if": {
"properties": {
"provider": {
"enum": ["watsonx"]
}
},
"required": ["provider"]
},
"then": {
"properties": {
"watsonxUrl": {
"type": "string"
},
"watsonxApiKey": {
"type": "string"
},
"watsonxZenApiKeyBase64": {
"type": "string"
},
"watsonxUsername": {
"type": "string"
},
"watsonxPassword": {
"type": "string"
},
"watsonxProjectId": {
"type": "string"
},
"model": {
"enum": [
"ibm/granite-13b-chat-v2",
"ibm/granite-13b-instruct-v2",
"mistralai/mistral-large",
"meta-llama/llama-3-8b-instruct",
"meta-llama/llama-3-70b-instruct"
]
}
},
"required": ["watsonxUrl", "watsonxProjectId"]
}
}
]
},

View file

@ -151,7 +151,6 @@
"@biomejs/biome": "1.6.4",
"@google/generative-ai": "^0.11.4",
"@types/follow-redirects": "^1.14.4",
"@types/isomorphic-fetch": "^0.0.39",
"@types/jest": "^29.5.12",
"@types/jquery": "^3.5.29",
"@types/jsdom": "^21.1.6",

1
gui/package-lock.json generated
View file

@ -144,7 +144,6 @@
"@biomejs/biome": "1.6.4",
"@google/generative-ai": "^0.11.4",
"@types/follow-redirects": "^1.14.4",
"@types/isomorphic-fetch": "^0.0.39",
"@types/jest": "^29.5.12",
"@types/jquery": "^3.5.29",
"@types/jsdom": "^21.1.6",

View file

@ -1,6 +1,6 @@
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import _ from "lodash";
import { useCallback, useContext, useEffect, useState } from "react";
import React, { 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,15 +14,13 @@ 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";
import { updatedObj } from "../../util";
import type { ProviderInfo } from "./configs/providers";
import { providers } from "./configs/providers";
import ContinueButton from "../../components/mainInput/ContinueButton";
import Toggle from "../../components/modelSelection/Toggle";
import React from "react";
const GridDiv = styled.div`
display: grid;
@ -67,8 +65,6 @@ function ConfigureProvider() {
undefined,
);
const [selectedModel, setSelectedModel] = useState({});
// different authentication flow is required for watsonx. This state helps to determine which flow to use for authentication
const [watsonxAuthenticate, setWatsonxAuthenticate] = React.useState(true);
@ -77,13 +73,9 @@ function ConfigureProvider() {
setModelInfo(providers[providerName]);
}
}, [providerName]);
useEffect(() => {
if (modelInfo) {
setSelectedModel(modelInfo);
}
}, [modelInfo]);
const handleContinue = () => {
if (!selectedModel) return;
if (!modelInfo) return;
let formParams: any = {};
for (const d of modelInfo.collectInputFor || []) {
@ -115,18 +107,14 @@ function ConfigureProvider() {
}, [modelInfo, formMethods]);
const enablecardsForApikey = useCallback(() => {
return (
modelInfo?.collectInputFor
?.filter((d) => d.isWatsonxAuthenticatedByApiKey)
.some((d) => !formMethods.watch(d.key))
);
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))
);
return modelInfo?.collectInputFor
?.filter((d) => d.isWatsonxAuthenticatedByCredentials)
.some((d) => !formMethods.watch(d.key));
}, [modelInfo, formMethods]);
return (
@ -176,7 +164,7 @@ function ConfigureProvider() {
{/* The WatsonX Authentication coukd be done by two different ways
1 ==> Using Api key
2 ==> Using Credentials */}
{providerName === "watsonx" ?
{providerName === "watsonx" ? (
<>
<div className="col-span-full py-4">
<Toggle
@ -190,139 +178,77 @@ function ConfigureProvider() {
</div>
{watsonxAuthenticate ? (
<>
{(modelInfo?.collectInputFor?.filter((d) => d.required).length || 0) >
0 && (
<>
<h3 className="mb-2">Enter required parameters</h3>
{(modelInfo?.collectInputFor?.filter((d) => d.required)
.length || 0) > 0 && (
<>
<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.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.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).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).length ||
0) > 0 && (
<details>
<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}>
<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>
);
})}
</details>
)}
{(modelInfo?.collectInputFor?.filter((d) => d.isWatsonxAttribute)
.length || 0) > 0 && (
<details>
<summary className="mb-2 cursor-pointer">
<b>WatsonX (Select a model by model id)</b>
</summary>
{modelInfo?.collectInputFor?.map((d, idx) => {
// Check the attribute is only for Watson X
if (d.isWatsonxAttribute)
return (
<div key={idx}>
{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}
@ -334,24 +260,48 @@ function ConfigureProvider() {
max={d.max}
step={d.step}
{...formMethods.register(d.key, {
required: false,
required: true,
})}
/>
</div>
);
})}
<ContinueButton
onClick={handleContinue}
disabled={
(disableModelCards() && enablecardsForApikey() && enablecardsForCredentials()) ||
modelInfo?.collectInputFor
?.filter((d) => d.isWatsonxAttribute)
.some((d) => !formMethods.watch(d.key))
}
showStop={false}
></ContinueButton>
</details>
)}
))}
</>
)}
</>
)}
{(modelInfo?.collectInputFor?.filter((d) => !d.required).length ||
0) > 0 && (
<details>
<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}>
<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>
);
})}
</details>
)}
<h3 className="mb-2">Select a model preset</h3>
</div>
<GridDiv>
@ -359,7 +309,11 @@ function ConfigureProvider() {
return (
<ModelCard
key={idx}
disabled={(disableModelCards() && enablecardsForApikey() && enablecardsForCredentials())}
disabled={
disableModelCards() &&
enablecardsForApikey() &&
enablecardsForCredentials()
}
title={pkg.title}
description={pkg.description}
tags={pkg.tags}
@ -367,7 +321,12 @@ function ConfigureProvider() {
icon={pkg.icon || modelInfo.icon}
dimensions={pkg.dimensions}
onClick={(e, dimensionChoices) => {
if ((disableModelCards() && enablecardsForApikey() && enablecardsForCredentials())) return;
if (
disableModelCards() &&
enablecardsForApikey() &&
enablecardsForCredentials()
)
return;
let formParams: any = {};
for (const d of modelInfo.collectInputFor || []) {
const val = formMethods.watch(d.key);

View file

@ -1,4 +1,4 @@
import { ChatMessage, ILLM, ModelProvider } from "core";
import { ILLM, ModelProvider } from "core";
import { ModelProviderTags } from "../../../components/modelSelection/ModelProviderTag";
import { InputDescriptor } from "./providers";
@ -704,7 +704,7 @@ export const models: { [key: string]: ModelPackage } = {
model: "ibm/granite-13b-instruct-v2",
contextLength: 20_000,
title: "Granite Code",
systemMessage: `You are Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior. You always respond to greetings (for example, hi, hello, g'day, morning, afternoon, evening, night, what's up, nice to meet you, sup, etc) with "Hello! I am Granite Chat, created by IBM. How can I help you today?". Please do not say anything else and do not start a conversation.`
systemMessage: `You are Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior. You always respond to greetings (for example, hi, hello, g'day, morning, afternoon, evening, night, what's up, nice to meet you, sup, etc) with "Hello! I am Granite Chat, created by IBM. How can I help you today?". Please do not say anything else and do not start a conversation.`,
},
providerOptions: ["watsonx"],
icon: "WatsonX.png",
@ -724,9 +724,9 @@ export const models: { [key: string]: ModelPackage } = {
isOpenSource: false,
},
MetaLlama3: {
title: "Meta-llama3",
title: "Meta Llama 3",
description:
"Llama-3 is an auto-regressive language model that uses an optimized transformer architecture.",
"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",

View file

@ -481,6 +481,82 @@ After it's up and running, you can start using Continue.`,
...openSourceModels,
],
},
watsonx: {
title: "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.`,
collectInputFor: [
{
inputType: "text",
key: "watsonxUrl",
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,
},
{
inputType: "text",
key: "watsonxProjectId",
label: "WatsonX Project Id",
placeholder: "Enter your project Id",
required: true,
isWatsonxAuthenticatedByApiKey: true,
isWatsonxAuthenticatedByCredentials: 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,
},
{
inputType: "text",
key: "title",
label: "Model name",
placeholder: "Granite 13B Chat v2",
isWatsonxAttribute: true,
},
{
inputType: "text",
key: "model",
label: "Model Id",
placeholder: "ibm/granite-13b-chat-v2",
isWatsonxAttribute: true,
},
...completionParamsInputsConfigs,
],
icon: "WatsonX.png",
tags: [ModelProviderTags.RequiresApiKey],
packages: [
models.graniteCode,
models.graniteChat,
models.MistralLarge,
models.MetaLlama3,
],
},
"free-trial": {
title: "Continue limited free trial",
provider: "free-trial",
@ -509,80 +585,4 @@ After it's up and running, you can start using Continue.`,
],
collectInputFor: [...completionParamsInputsConfigs],
},
watsonx: {
title: "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.`,
collectInputFor: [
{
inputType: "text",
key: "watsonxUrl",
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
},
{
inputType: "text",
key: "watsonxProjectId",
label: "WatsonX Project Id",
placeholder: "Enter your project Id",
required: true,
isWatsonxAuthenticatedByApiKey: true,
isWatsonxAuthenticatedByCredentials: 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
},
{
inputType: "text",
key: "title",
label: "Model name",
placeholder: "Granite 13B Chat v2",
isWatsonxAttribute: true,
},
{
inputType: "text",
key: "model",
label: "Model Id",
placeholder: "ibm/granite-13b-chat-v2",
isWatsonxAttribute: true,
},
...completionParamsInputsConfigs,
],
icon: "WatsonX.png",
tags: [ModelProviderTags.RequiresApiKey],
packages: [
models.graniteCode,
models.graniteChat,
models.MistralLarge,
models.MetaLlama3
],
},
};