diff --git a/libs/ibm/langchain_ibm/llms.py b/libs/ibm/langchain_ibm/llms.py index 51779f2..355a65a 100644 --- a/libs/ibm/langchain_ibm/llms.py +++ b/libs/ibm/langchain_ibm/llms.py @@ -141,15 +141,19 @@ def validate_environment(cls, values: Dict) -> Any: """Validate that credentials and python package exists in environment.""" if isinstance(values.get("watsonx_model"), (ModelInference, Model)): values["model_id"] = getattr(values["watsonx_model"], "model_id") - values["deployment_id"] = getattr( - values["watsonx_model"], "deployment_id", "" + values["deployment_id"] = ( + getattr(values["watsonx_model"], "deployment_id", "") or "" ) - values["project_id"] = getattr( - getattr(values["watsonx_model"], "_client"), - "default_project_id", + values["project_id"] = ( + getattr( + getattr(values["watsonx_model"], "_client"), + "default_project_id", + ) + or "" ) - values["space_id"] = getattr( - getattr(values["watsonx_model"], "_client"), "default_space_id" + values["space_id"] = ( + getattr(getattr(values["watsonx_model"], "_client"), "default_space_id") + or "" ) values["params"] = getattr(values["watsonx_model"], "params")