You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[langchain-ibm/feat]: Added support for Model Gateway (Embeddings), Added async methods (#88)
* Added support for Model Gateway Embeddings, added async methods
* Added more informing docstring under model parameter
* Added warning when user get ApiRequestFailure
* Added warning for watsonx_embed_gateway
Copy file name to clipboardExpand all lines: libs/ibm/langchain_ibm/chat_models.py
+34-7Lines changed: 34 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -82,9 +82,11 @@
82
82
fromtyping_extensionsimportSelf
83
83
84
84
fromlangchain_ibm.utilsimport (
85
+
async_gateway_error_handler,
85
86
check_duplicate_chat_params,
86
87
check_for_attribute,
87
88
extract_chat_params,
89
+
gateway_error_handler,
88
90
)
89
91
90
92
logger=logging.getLogger(__name__)
@@ -430,7 +432,16 @@ class ChatWatsonx(BaseChatModel):
430
432
"""Type of model to use."""
431
433
432
434
model: Optional[str] =None
433
-
"""Name of model for given provider or alias."""
435
+
"""
436
+
Name or alias of the foundation model to use.
437
+
When using IBM’s watsonx.ai Model Gateway (public preview), you can specify any
438
+
supported third-party model—OpenAI, Anthropic, NVIDIA, Cerebras, or IBM’s own
439
+
Granite series—via a single, OpenAI-compatible interface. Models must be explicitly
440
+
provisioned (opt-in) through the Gateway to ensure secure, vendor-agnostic access
441
+
and easy switch-over without reconfiguration.
442
+
443
+
For more details on configuration and usage, see IBM watsonx Model Gateway docs: https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-model-gateway.html?context=wx&audience=wdp
@@ -19,6 +25,18 @@ class WatsonxEmbeddings(BaseModel, LangChainEmbeddings):
19
25
model_id: Optional[str] =None
20
26
"""Type of model to use."""
21
27
28
+
model: Optional[str] =None
29
+
"""
30
+
Name or alias of the foundation model to use.
31
+
When using IBM’s watsonx.ai Model Gateway (public preview), you can specify any
32
+
supported third-party model—OpenAI, Anthropic, NVIDIA, Cerebras, or IBM’s own
33
+
Granite series—via a single, OpenAI-compatible interface. Models must be explicitly
34
+
provisioned (opt-in) through the Gateway to ensure secure, vendor-agnostic access
35
+
and easy switch-over without reconfiguration.
36
+
37
+
For more details on configuration and usage, see IBM watsonx Model Gateway docs: https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-model-gateway.html?context=wx&audience=wdp
38
+
"""
39
+
22
40
project_id: Optional[str] =None
23
41
"""ID of the Watson Studio project."""
24
42
@@ -70,10 +88,15 @@ class WatsonxEmbeddings(BaseModel, LangChainEmbeddings):
70
88
* the path to a CA_BUNDLE file
71
89
* the path of directory with certificates of trusted CAs
0 commit comments