From 4add059df44c877475eae8484fcde23b25cdf9d6 Mon Sep 17 00:00:00 2001 From: tudormatei Date: Fri, 17 Jul 2026 16:13:58 +0300 Subject: [PATCH] fix(chat): raise ModelNotFoundError on legacy discovery-miss The legacy chat model factory raised a bare ValueError when a model was not returned by the discovery API, indistinguishable from other ValueErrors without matching on the error message text. Raise uipath-llm-client's ModelNotFoundError instead (added in uipath-llm-client 1.17.1). It subclasses ValueError, so existing `except ValueError` handlers keep working. Bumps the uipath-llm-client / uipath-langchain-client floors to >=1.17.1 and the package version to 0.14.11. --- pyproject.toml | 18 +++++++++--------- .../chat/_legacy/chat_model_factory.py | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8297a7d10..b3d4154b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-langchain" -version = "0.14.10" +version = "0.14.11" description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" @@ -9,7 +9,7 @@ dependencies = [ "uipath-core>=0.5.29, <0.6.0", "uipath-platform>=0.2.10, <0.3.0", "uipath-runtime>=0.12.1, <0.13.0", - "uipath-llm-client>=1.17.0, <1.18.0", + "uipath-llm-client>=1.17.1, <1.18.0", "langgraph>=1.1.8, <2.0.0", "langchain-core>=1.2.27, <2.0.0", "langgraph-checkpoint-sqlite>=3.0.3, <4.0.0", @@ -26,7 +26,7 @@ dependencies = [ "pillow>=12.1.1", "rdflib>=7.0.0, <8.0.0", "a2a-sdk>=0.2.0,<1.0.0", - "uipath-langchain-client[openai]>=1.17.0,<1.18.0", + "uipath-langchain-client[openai]>=1.17.1,<1.18.0", ] classifiers = [ @@ -43,21 +43,21 @@ maintainers = [ [project.optional-dependencies] anthropic = [ - "uipath-langchain-client[anthropic]>=1.17.0,<1.18.0", + "uipath-langchain-client[anthropic]>=1.17.1,<1.18.0", ] vertex = [ - "uipath-langchain-client[google]>=1.17.0,<1.18.0", - "uipath-langchain-client[vertexai]>=1.17.0,<1.18.0", + "uipath-langchain-client[google]>=1.17.1,<1.18.0", + "uipath-langchain-client[vertexai]>=1.17.1,<1.18.0", ] bedrock = [ - "uipath-langchain-client[bedrock]>=1.17.0,<1.18.0", + "uipath-langchain-client[bedrock]>=1.17.1,<1.18.0", "boto3-stubs>=1.41.4", ] fireworks = [ - "uipath-langchain-client[fireworks]>=1.17.0,<1.18.0", + "uipath-langchain-client[fireworks]>=1.17.1,<1.18.0", ] all = [ - "uipath-langchain-client[all]>=1.17.0,<1.18.0", + "uipath-langchain-client[all]>=1.17.1,<1.18.0", ] [project.entry-points."uipath.middlewares"] diff --git a/src/uipath_langchain/chat/_legacy/chat_model_factory.py b/src/uipath_langchain/chat/_legacy/chat_model_factory.py index 940cfcf75..b4afe3664 100644 --- a/src/uipath_langchain/chat/_legacy/chat_model_factory.py +++ b/src/uipath_langchain/chat/_legacy/chat_model_factory.py @@ -234,7 +234,9 @@ def _get_model_info( matching_models = [m for m in matching_models if m.get("byomDetails") is None] if not matching_models: - raise ValueError( + from uipath.llm_client.utils.exceptions import ModelNotFoundError + + raise ModelNotFoundError( f"model='{model}' and byo_connection_id={byo_connection_id}" + " is not available. It was not returned by the discovery API." )