Skip to content

Commit 1ba971d

Browse files
Add IBM watsonx AI provider in the list of AI providers
1 parent 98a8485 commit 1ba971d

File tree

2 files changed

+9
-49
lines changed

2 files changed

+9
-49
lines changed

packages/types/src/providers/ibm-watsonx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ export const watsonxModels = {
3636
"ibm/granite-3-3-8b-instruct": {
3737
...baseModelInfo,
3838
},
39-
} as const satisfies Record<string, ModelInfo>
39+
} as const satisfies Record<string, ModelInfo>

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -240,46 +240,7 @@ const ApiOptions = ({
240240
) {
241241
vscode.postMessage({ type: "requestRouterModels" })
242242
} else if (selectedProvider === "ibm-watsonx") {
243-
const {
244-
watsonxPlatform,
245-
watsonxApiKey,
246-
watsonxProjectId,
247-
watsonxBaseUrl,
248-
watsonxAuthType,
249-
watsonxUsername,
250-
watsonxPassword,
251-
watsonxRegion,
252-
} = apiConfiguration
253-
254-
const ibmCloudReady =
255-
watsonxPlatform === "ibmCloud" && !!watsonxApiKey && !!watsonxProjectId && !!watsonxRegion
256-
257-
const cloudPakReady =
258-
watsonxPlatform === "cloudPak" &&
259-
!!watsonxBaseUrl &&
260-
!!watsonxProjectId &&
261-
!!watsonxUsername &&
262-
((watsonxAuthType === "apiKey" && !!watsonxApiKey) ||
263-
(watsonxAuthType === "password" && !!watsonxPassword))
264-
265-
if (ibmCloudReady || cloudPakReady) {
266-
vscode.postMessage({
267-
type: "requestWatsonxModels",
268-
values: {
269-
apiKey: apiConfiguration.watsonxApiKey,
270-
projectId: apiConfiguration.watsonxProjectId,
271-
platform: apiConfiguration.watsonxPlatform,
272-
baseUrl:
273-
apiConfiguration.watsonxPlatform === "ibmCloud"
274-
? undefined
275-
: apiConfiguration.watsonxBaseUrl,
276-
authType: apiConfiguration.watsonxAuthType,
277-
username: apiConfiguration.watsonxUsername,
278-
password: apiConfiguration.watsonxPassword,
279-
region: apiConfiguration.watsonxRegion,
280-
},
281-
})
282-
}
243+
vscode.postMessage({ type: "requestWatsonxModels" })
283244
}
284245
},
285246
250,
@@ -294,14 +255,13 @@ const ApiOptions = ({
294255
apiConfiguration?.litellmApiKey,
295256
apiConfiguration?.deepInfraApiKey,
296257
apiConfiguration?.deepInfraBaseUrl,
297-
apiConfiguration?.watsonxPlatform,
298-
apiConfiguration?.watsonxApiKey,
299-
apiConfiguration?.watsonxProjectId,
300-
apiConfiguration?.watsonxBaseUrl,
301-
apiConfiguration?.watsonxAuthType,
302-
apiConfiguration?.watsonxUsername,
303-
apiConfiguration?.watsonxPassword,
304-
apiConfiguration?.watsonxRegion,
258+
apiConfiguration.watsonxPlatform,
259+
apiConfiguration.watsonxApiKey,
260+
apiConfiguration.watsonxProjectId,
261+
apiConfiguration.watsonxBaseUrl,
262+
apiConfiguration.watsonxAuthType,
263+
apiConfiguration.watsonxUsername,
264+
apiConfiguration.watsonxPassword,
305265
customHeaders,
306266
],
307267
)

0 commit comments

Comments
 (0)