fix: valdiate watsonX key and enable tool calling for Watson X models (#11264)

* valdiate watsonX key

* [autofix.ci] apply automated fixes

* enable tool calling

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Himavarsha
2026-01-12 14:58:03 -05:00
committed by GitHub
parent 3166d1f08f
commit 8da8fdccef
3 changed files with 19 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -319,9 +319,18 @@ def validate_model_provider_key(variable_name: str, api_key: str) -> None:
llm = ChatGoogleGenerativeAI(google_api_key=api_key, model=first_model, max_tokens=1)
llm.invoke("test")
elif provider == "IBM WatsonX":
# WatsonX validation would require additional parameters
# Skip for now as it needs project_id, url, etc.
return
from langchain_ibm import ChatWatsonx
default_url = "https://us-south.ml.cloud.ibm.com"
llm = ChatWatsonx(
apikey=api_key,
url=default_url,
model_id=first_model,
project_id="dummy_project_for_validation", # Dummy project_id for validation
params={"max_new_tokens": 1},
)
llm.invoke("test")
elif provider == "Ollama":
# Ollama is local, just verify the URL is accessible
import requests

View File

@ -6,7 +6,7 @@ WATSONX_DEFAULT_LLM_MODELS = [
name="ibm/granite-3-2b-instruct",
icon="WatsonxAI",
model_type="llm",
tool_calling=False,
tool_calling=True,
default=True,
),
create_model_metadata(
@ -22,7 +22,7 @@ WATSONX_DEFAULT_LLM_MODELS = [
name="ibm/granite-13b-instruct-v2",
icon="WatsonxAI",
model_type="llm",
tool_calling=False,
tool_calling=True,
default=True,
),
]
@ -33,6 +33,7 @@ WATSONX_DEFAULT_EMBEDDING_MODELS = [
name="sentence-transformers/all-minilm-l12-v2",
icon="WatsonxAI",
model_type="embeddings",
tool_calling=True,
default=True,
),
create_model_metadata(
@ -40,6 +41,7 @@ WATSONX_DEFAULT_EMBEDDING_MODELS = [
name="ibm/slate-125m-english-rtrvr-v2",
icon="WatsonxAI",
model_type="embeddings",
tool_calling=True,
default=True,
),
create_model_metadata(
@ -47,6 +49,7 @@ WATSONX_DEFAULT_EMBEDDING_MODELS = [
name="ibm/slate-30m-english-rtrvr-v2",
icon="WatsonxAI",
model_type="embeddings",
tool_calling=True,
default=True,
),
create_model_metadata(
@ -54,6 +57,7 @@ WATSONX_DEFAULT_EMBEDDING_MODELS = [
name="intfloat/multilingual-e5-large",
icon="WatsonxAI",
model_type="embeddings",
tool_calling=True,
default=True,
),
]