Skip to content

Commit 3cc95c1

Browse files
update feedback from roomote
1 parent 26e7aa7 commit 3cc95c1

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/api/providers/fetchers/ibm-watsonx.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function getWatsonxModels(
4141
throw new Error("Project ID is required for IBM Cloud")
4242
}
4343
if (!baseUrl) {
44-
throw new Error("Base URL is required for for IBM Cloud")
44+
throw new Error("Base URL is required for IBM Cloud")
4545
}
4646
options.serviceUrl = baseUrl
4747
options.authenticator = new IamAuthenticator({
@@ -148,21 +148,22 @@ export async function getWatsonxModels(
148148
}
149149
}
150150

151+
export const REGION_TO_URL: Record<string, string> = {
152+
"us-south": "https://us-south.ml.cloud.ibm.com",
153+
"eu-de": "https://eu-de.ml.cloud.ibm.com",
154+
"eu-gb": "https://eu-gb.ml.cloud.ibm.com",
155+
"jp-tok": "https://jp-tok.ml.cloud.ibm.com",
156+
"au-syd": "https://au-syd.ml.cloud.ibm.com",
157+
"ca-tor": "https://ca-tor.ml.cloud.ibm.com",
158+
"ap-south-1": "https://ap-south-1.aws.wxai.ibm.com",
159+
custom: "",
160+
}
151161
/**
152162
* Returns the base URL for IBM Watsonx services corresponding to the given region.
153163
*
154164
* @param region - The region identifier (e.g., "us-south", "eu-de").
155165
* @returns The base URL as a string for the specified region, or `undefined` if the region is not recognized.
156166
*/
157167
export function regionToWatsonxBaseUrl(region: string): string {
158-
const regionToUrl: Record<string, string> = {
159-
"us-south": "https://us-south.ml.cloud.ibm.com",
160-
"eu-de": "https://eu-de.ml.cloud.ibm.com",
161-
"eu-gb": "https://eu-gb.ml.cloud.ibm.com",
162-
"jp-tok": "https://jp-tok.ml.cloud.ibm.com",
163-
"au-syd": "https://au-syd.ml.cloud.ibm.com",
164-
"ca-tor": "https://ca-tor.ml.cloud.ibm.com",
165-
"ap-south-1": "https://ap-south-1.aws.wxai.ibm.com",
166-
}
167-
return regionToUrl[region]
168+
return REGION_TO_URL[region]
168169
}

0 commit comments

Comments
 (0)