diff --git a/.vscode/settings.json b/.vscode/settings.json index f56d10f61..41b357765 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,5 +18,8 @@ "binary/": false, "**/core/vendor/**": true, "**/gui/dist": true - } + }, + "eslint.workingDirectories": [ + "./core" + ] } diff --git a/binary/package-lock.json b/binary/package-lock.json index d2fd02d2b..7ed2f9aea 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -57,6 +57,7 @@ "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", "axios": "^1.6.7", + "cheerio": "^1.0.0-rc.12", "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", diff --git a/core/index.d.ts b/core/index.d.ts index 2ed65799f..cb5539f11 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -362,6 +362,7 @@ export interface LLMOptions { watsonxProjectId?: string; watsonxStopToken?: string; watsonxApiVersion?: string; + watsonxFullUrl?: string; cacheSystemMessage?: boolean; } diff --git a/core/llm/index.ts b/core/llm/index.ts index b6cbb65b8..94e9ee322 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -118,6 +118,7 @@ export abstract class BaseLLM implements ILLM { watsonxProjectId?: string; watsonxStopToken?: string; watsonxApiVersion?: string; + watsonxFullUrl?: string; cacheSystemMessage?: boolean; @@ -180,6 +181,7 @@ export abstract class BaseLLM implements ILLM { this.watsonxProjectId = options.watsonxProjectId; this.watsonxStopToken = options.watsonxStopToken; this.watsonxApiVersion = options.watsonxApiVersion; + this.watsonxFullUrl = options.watsonxFullUrl; this.cacheSystemMessage = options.cacheSystemMessage; diff --git a/core/llm/llms/WatsonX.ts b/core/llm/llms/WatsonX.ts index 68dfef47c..f7ea473e0 100644 --- a/core/llm/llms/WatsonX.ts +++ b/core/llm/llms/WatsonX.ts @@ -84,6 +84,10 @@ class WatsonX extends BaseLLM { } } + getWatsonxEndpoint(): string { + return this.watsonxFullUrl ?? `${this.watsonxUrl}/ml/v1/text/generation_stream?version=${this.watsonxApiVersion}`; + } + static providerName: ModelProvider = "watsonx"; protected _convertMessage(message: ChatMessage) { @@ -186,8 +190,9 @@ class WatsonX extends BaseLLM { const stopToken = this.watsonxStopToken ?? (options.model?.includes("granite") ? "<|im_end|>" : undefined); + const url = this.getWatsonxEndpoint(); var response = await this.fetch( - `${this.watsonxUrl}/ml/v1/text/generation_stream?version=${this.watsonxApiVersion}`, + url, { method: "POST", headers: { diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 7166520e1..e9df56cd0 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1255,6 +1255,9 @@ "watsonxStopToken": { "type": "string" }, + "watsonxFullUrl": { + "type": "string" + }, "model": { "enum": [ "ibm/granite-13b-chat-v2", diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 7166520e1..e9df56cd0 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -1255,6 +1255,9 @@ "watsonxStopToken": { "type": "string" }, + "watsonxFullUrl": { + "type": "string" + }, "model": { "enum": [ "ibm/granite-13b-chat-v2", diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 7166520e1..e9df56cd0 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1255,6 +1255,9 @@ "watsonxStopToken": { "type": "string" }, + "watsonxFullUrl": { + "type": "string" + }, "model": { "enum": [ "ibm/granite-13b-chat-v2", diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 70c584b9e..b0524b048 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -1390,6 +1390,9 @@ "watsonxStopToken": { "type": "string" }, + "watsonxFullUrl": { + "type": "string" + }, "model": { "enum": [ "ibm/granite-13b-chat-v2", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index dacb3d8d6..e0de2ffb0 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.206", + "version": "0.9.207", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.206", + "version": "0.9.207", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 5335c91b6..b4f093642 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.206", + "version": "0.9.207", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index e36bd35b4..2cd32b876 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -513,6 +513,13 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo placeholder: "Enter the API Version", defaultValue: "2023-05-29" }, + { + inputType: "text", + key: "watsonxFullUrl", + label: "Full watsonx URL", + placeholder: "http://us-south.dataplatform.cloud.ibm.com/m1/v1/text/generation_stream?version=2023-05-29", + required: false + }, // { // inputType: "text", // key: "title",