Skip to content

Commit bced2a4

Browse files
committed
chore: clean up watsonx urls
clean up watsonx urls
1 parent 91d73e7 commit bced2a4

4 files changed

Lines changed: 6 additions & 25 deletions

File tree

src/lfx/src/lfx/components/ibm/watsonx.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from pydantic.v1 import SecretStr
77

88
from lfx.base.models.model import LCModelComponent
9+
from lfx.base.models.watsonx_constants import IBM_WATSONX_URLS
910
from lfx.field_typing import LanguageModel
1011
from lfx.field_typing.range_spec import RangeSpec
1112
from lfx.inputs.inputs import BoolInput, DropdownInput, IntInput, SecretStrInput, SliderInput, StrInput
@@ -21,14 +22,7 @@ class WatsonxAIComponent(LCModelComponent):
2122
beta = False
2223

2324
_default_models = ["ibm/granite-3-2b-instruct", "ibm/granite-3-8b-instruct", "ibm/granite-13b-instruct-v2"]
24-
_urls = [
25-
"https://us-south.ml.cloud.ibm.com",
26-
"https://eu-de.ml.cloud.ibm.com",
27-
"https://eu-gb.ml.cloud.ibm.com",
28-
"https://au-syd.ml.cloud.ibm.com",
29-
"https://jp-tok.ml.cloud.ibm.com",
30-
"https://ca-tor.ml.cloud.ibm.com",
31-
]
25+
_urls = IBM_WATSONX_URLS
3226
inputs = [
3327
*LCModelComponent.get_base_inputs(),
3428
DropdownInput(

src/lfx/src/lfx/components/ibm/watsonx_embeddings.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pydantic.v1 import SecretStr
88

99
from lfx.base.embeddings.model import LCEmbeddingsModel
10+
from lfx.base.models.watsonx_constants import IBM_WATSONX_URLS
1011
from lfx.field_typing import Embeddings
1112
from lfx.io import BoolInput, DropdownInput, IntInput, SecretStrInput, StrInput
1213
from lfx.log.logger import logger
@@ -33,14 +34,7 @@ class WatsonxEmbeddingsComponent(LCEmbeddingsModel):
3334
display_name="watsonx API Endpoint",
3435
info="The base URL of the API.",
3536
value=None,
36-
options=[
37-
"https://us-south.ml.cloud.ibm.com",
38-
"https://eu-de.ml.cloud.ibm.com",
39-
"https://eu-gb.ml.cloud.ibm.com",
40-
"https://au-syd.ml.cloud.ibm.com",
41-
"https://jp-tok.ml.cloud.ibm.com",
42-
"https://ca-tor.ml.cloud.ibm.com",
43-
],
37+
options={IBM_WATSONX_URLS},
4438
real_time_refresh=True,
4539
),
4640
StrInput(

src/lfx/src/lfx/components/models/embedding_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def build_embeddings(self) -> Embeddings:
157157

158158
params = {
159159
"model_id": model,
160-
"url": base_url_ibm_watsonx or "https://us-south.ml.cloud.ibm.com",
160+
"url": base_url_ibm_watsonx or IBM_WATSONX_URLS[0],
161161
"apikey": api_key,
162162
}
163163

src/lfx/src/lfx/components/models/language_model.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from lfx.base.models.google_generative_ai_model import ChatGoogleGenerativeAIFixed
1414
from lfx.base.models.model import LCModelComponent
1515
from lfx.base.models.openai_constants import OPENAI_CHAT_MODEL_NAMES, OPENAI_REASONING_MODEL_NAMES
16+
from lfx.base.models.watsonx_constants import IBM_WATSONX_URLS
1617
from lfx.field_typing import LanguageModel
1718
from lfx.field_typing.range_spec import RangeSpec
1819
from lfx.inputs.inputs import BoolInput, MessageTextInput, StrInput
@@ -23,14 +24,6 @@
2324

2425
# IBM watsonx.ai constants
2526
IBM_WATSONX_DEFAULT_MODELS = ["ibm/granite-3-2b-instruct", "ibm/granite-3-8b-instruct", "ibm/granite-13b-instruct-v2"]
26-
IBM_WATSONX_URLS = [
27-
"https://us-south.ml.cloud.ibm.com",
28-
"https://eu-de.ml.cloud.ibm.com",
29-
"https://eu-gb.ml.cloud.ibm.com",
30-
"https://au-syd.ml.cloud.ibm.com",
31-
"https://jp-tok.ml.cloud.ibm.com",
32-
"https://ca-tor.ml.cloud.ibm.com",
33-
]
3427

3528

3629
class LanguageModelComponent(LCModelComponent):

0 commit comments

Comments
 (0)