Merge branch 'B-Rajpal-feat/watsonx' into dev

This commit is contained in:
Nate Sesti 2024-08-02 09:50:14 -07:00
commit ccae40c31d
14 changed files with 644 additions and 34 deletions

11
core/index.d.ts vendored
View file

@ -343,6 +343,14 @@ export interface LLMOptions {
region?: string;
projectId?: string;
capabilities?: ModelCapability;
// WatsonX options
watsonxUrl?: string;
watsonxApiKey?: string;
watsonxZenApiKeyBase64?:string// Required if using watsonx software with ZenApiKey auth
watsonxUsername?:string;
watsonxPassword?:string;
watsonxProjectId?: string;
}
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
T,
@ -594,7 +602,8 @@ type ModelProvider =
| "deepseek"
| "azure"
| "openai-aiohttp"
| "msty";
| "msty"
| "watsonx";
export type ModelName =
| "AUTODETECT"

View file

@ -105,6 +105,16 @@ export abstract class BaseLLM implements ILLM {
accountId?: string;
aiGatewaySlug?: string;
// For WatsonX only.
watsonxUrl?: string;
watsonxApiKey?: string;
watsonxZenApiKeyBase64?:string = "YOUR_WATSONX_ZENAPIKEY" // Required if using watsonx software with ZenApiKey auth
watsonxUsername?:string;
watsonxPassword?:string;
watsonxProjectId?: string;
private _llmOptions: LLMOptions;
constructor(_options: LLMOptions) {
@ -156,6 +166,13 @@ 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.watsonxProjectId = options.watsonxProjectId;
this.watsonxUsername = options.watsonxUsername;
this.watsonxPassword = options.watsonxPassword;
if (this.apiBase && !this.apiBase.endsWith("/")) {
this.apiBase = `${this.apiBase}/`;
}

249
core/llm/llms/WatsonX.ts Normal file
View file

@ -0,0 +1,249 @@
import {
ChatMessage,
CompletionOptions,
LLMOptions,
ModelProvider,
} from "../../index.js";
import { stripImages } from "../images.js";
import { BaseLLM } from "../index.js";
const watsonxConfig = {
accessToken: {
expiration: 0,
token: "",
},
};
class WatsonX extends BaseLLM {
protected maxStopWords: number | undefined = undefined;
constructor(options: LLMOptions) {
super(options);
}
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();
return {
token: wxToken["access_token"],
expiration: wxToken["expiration"],
};
} else {
// watsonx Software
if (
this.watsonxZenApiKeyBase64 &&
this.watsonxZenApiKeyBase64 !== "YOUR_WATSONX_ZENAPIKEY"
) {
// Using ZenApiKey auth
return {
token: this.watsonxZenApiKeyBase64,
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,
}),
})
).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"],
};
}
}
}
static providerName: ModelProvider = "watsonx";
protected _convertMessage(message: ChatMessage) {
if (typeof message.content === "string") {
return message;
}
const parts = message.content.map((part) => {
const msg: any = {
type: part.type,
text: part.text,
};
if (part.type === "imageUrl") {
msg.image_url = { ...part.imageUrl, detail: "low" };
msg.type = "image_url";
}
return msg;
});
return {
...message,
content: parts,
};
}
protected _convertModelName(model: string): string {
return model;
}
protected _convertArgs(options: any, messages: ChatMessage[]) {
const finalOptions = {
messages: messages.map(this._convertMessage),
model: this._convertModelName(options.model),
max_tokens: options.maxTokens,
temperature: options.temperature,
top_p: options.topP,
frequency_penalty: options.frequencyPenalty,
presence_penalty: options.presencePenalty,
};
return finalOptions;
}
protected _getHeaders() {
return {
"Content-Type": "application/json",
Authorization: `${watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer"} ${watsonxConfig.accessToken.token}`,
};
}
protected async _complete(
prompt: string,
options: CompletionOptions,
): Promise<string> {
let completion = "";
for await (const chunk of this._streamChat(
[{ role: "user", content: prompt }],
options,
)) {
completion += chunk.content;
}
return completion;
}
protected async *_streamComplete(
prompt: string,
options: CompletionOptions,
): AsyncGenerator<string> {
for await (const chunk of this._streamChat(
[{ role: "user", content: prompt }],
options,
)) {
yield stripImages(chunk.content);
}
}
protected async *_streamChat(
messages: ChatMessage[],
options: CompletionOptions,
): AsyncGenerator<ChatMessage> {
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)`,
);
}
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,
},
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 {
const reader = streamResponse.body.getReader();
while (true) {
const chunk = await reader.read();
if (chunk.done) {
break;
}
// Decode the stream
const textResponseMsg = new TextDecoder().decode(chunk.value);
const lines = textResponseMsg.split(/\r?\n/);
let generatedChunk = "";
let generatedTextIndex = undefined;
lines.forEach((el) => {
// 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}`);
}
} else if (el.startsWith("data:")) {
const dataStr = el.replace(/^data:\s+/, "");
try {
const data = JSON.parse(dataStr);
data.results.forEach((result: any) => {
generatedChunk += result.generated_text || "";
});
} catch (e) {
throw e;
}
}
});
generatedChunk = generatedChunk.replaceAll("<|im_end|>", " ");
generatedChunk = generatedChunk.replaceAll("<|im_start|> ", "\n");
yield {
role: "assistant",
content: generatedChunk,
};
}
}
}
}
export default WatsonX;

View file

@ -34,6 +34,7 @@ import Replicate from "./Replicate.js";
import TextGenWebUI from "./TextGenWebUI.js";
import Together from "./Together.js";
import ContinueProxy from "./stubs/ContinueProxy.js";
import WatsonX from "./WatsonX.js";
function convertToLetter(num: number): string {
let result = "";
@ -126,6 +127,7 @@ const LLMs = [
Deepseek,
Msty,
Azure,
WatsonX
];
export async function llmFromDescription(

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -0,0 +1,15 @@
# 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.
## 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).
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
## Usage
![usage-gif](../Model%20Providers/assets/Watsonx1.gif)

View file

@ -45,6 +45,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)
### Remote

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",

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

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,6 +14,7 @@ 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";
@ -64,12 +65,35 @@ 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) => {
@ -82,6 +106,17 @@ 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">
@ -126,31 +161,112 @@ function ConfigureProvider() {
/>
<br />
{(modelInfo?.collectInputFor?.filter((d) => d.required).length || 0) >
0 && (
{/* The WatsonX Authentication coukd be done by two different ways
1 ==> Using Api key
2 ==> Using Credentials */}
{providerName === "watsonx" ? (
<>
<h3 className="mb-2">Enter required parameters</h3>
<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>
{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>
))}
{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>
))}
</>
)}
</>
)}
@ -160,8 +276,9 @@ 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}>
@ -170,7 +287,7 @@ function ConfigureProvider() {
type={d.inputType}
id={d.key}
className="border-2 border-gray-200 rounded-md p-2 m-2"
placeholder={d.label}
placeholder={d.placeholder}
defaultValue={d.defaultValue}
min={d.min}
max={d.max}
@ -192,7 +309,11 @@ function ConfigureProvider() {
return (
<ModelCard
key={idx}
disabled={disableModelCards()}
disabled={
disableModelCards() &&
enablecardsForApikey() &&
enablecardsForCredentials()
}
title={pkg.title}
description={pkg.description}
tags={pkg.tags}
@ -200,7 +321,12 @@ function ConfigureProvider() {
icon={pkg.icon || modelInfo.icon}
dimensions={pkg.dimensions}
onClick={(e, dimensionChoices) => {
if (disableModelCards()) return;
if (
disableModelCards() &&
enablecardsForApikey() &&
enablecardsForCredentials()
)
return;
let formParams: any = {};
for (const d of modelInfo.collectInputFor || []) {
const val = formMethods.watch(d.key);

View file

@ -9,7 +9,6 @@ export interface PackageDimension {
description: string;
options: { [key: string]: { [key: string]: any } };
}
export interface ModelPackage {
title: string;
icon?: string;
@ -684,6 +683,75 @@ export const models: { [key: string]: ModelPackage } = {
icon: "anthropic.png",
isOpenSource: false,
},
graniteChat: {
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: {
model: "ibm/granite-13b-chat-v2",
contextLength: 20_000,
title: "Granite Chat",
},
providerOptions: ["watsonx"],
icon: "",
isOpenSource: false,
},
graniteCode: {
title: "WatsonX - Granite Code",
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-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.`,
},
providerOptions: ["watsonx"],
icon: "WatsonX.png",
isOpenSource: false,
},
MistralLarge: {
title: "WatsonX - Mistral",
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",
},
providerOptions: ["watsonx"],
icon: "mistral.png",
isOpenSource: false,
},
MetaLlama3: {
title: "Meta Llama 3",
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",
contextLength: 20_000,
},
icon: "meta.png",
dimensions: [
{
name: "Parameter Count",
description: "The number of parameters in the model",
options: {
"8b": {
model: "meta-llama/llama-3-8b-instruct",
title: "Meta-llama3-8b",
},
"70b": {
model: "meta-llama/llama-3-70b-instruct",
title: "Meta-llama3-70b",
},
},
},
],
providerOptions: ["watsonx"],
isOpenSource: false,
},
AUTODETECT: {
title: "Autodetect",
description:

View file

@ -19,6 +19,11 @@ 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 {
@ -476,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",