From 5423db27e2290fa04338458b6b839eba281168ad Mon Sep 17 00:00:00 2001 From: Cosmin Maria Date: Mon, 23 Mar 2026 14:34:24 +0200 Subject: [PATCH 1/2] fix: byom fix to select vendor based on api flavor --- CHANGELOG.md | 5 +++++ packages/uipath_langchain_client/CHANGELOG.md | 5 +++++ .../uipath_langchain_client/pyproject.toml | 2 +- .../uipath_langchain_client/__version__.py | 2 +- .../src/uipath_langchain_client/factory.py | 21 ++++++++++++------- .../src/uipath_langchain_client/settings.py | 9 +++++++- src/uipath/llm_client/__version__.py | 2 +- src/uipath/llm_client/settings/constants.py | 10 +++++++++ 8 files changed, 45 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index affa8e1..c8b53d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to `uipath_llm_client` (core package) will be documented in this file. +## [1.5.7] - 2026-03-23 + +### Fix +- Added mapping api_flavor to vendor_type + ## [1.5.6] - 2026-03-21 ### Feature diff --git a/packages/uipath_langchain_client/CHANGELOG.md b/packages/uipath_langchain_client/CHANGELOG.md index cd66913..f2ebebb 100644 --- a/packages/uipath_langchain_client/CHANGELOG.md +++ b/packages/uipath_langchain_client/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to `uipath_langchain_client` will be documented in this file. +## [1.5.7] - 2026-03-23 + +### Fix +- Fix factory for BYO to handle the case where vendor_type is None, but api_flavor is discovered + ## [1.5.6] - 2026-03-21 ### Feature diff --git a/packages/uipath_langchain_client/pyproject.toml b/packages/uipath_langchain_client/pyproject.toml index 3e55e08..63171ef 100644 --- a/packages/uipath_langchain_client/pyproject.toml +++ b/packages/uipath_langchain_client/pyproject.toml @@ -6,7 +6,7 @@ readme = "README.md" requires-python = ">=3.11" dependencies = [ "langchain>=1.2.13", - "uipath-llm-client>=1.5.6", + "uipath-llm-client>=1.5.7", ] [project.optional-dependencies] diff --git a/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py b/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py index 35428ab..bca8933 100644 --- a/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py +++ b/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py @@ -1,3 +1,3 @@ __title__ = "UiPath LangChain Client" __description__ = "A Python client for interacting with UiPath's LLM services via LangChain." -__version__ = "1.5.6" +__version__ = "1.5.7" diff --git a/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py b/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py index 228596a..71275fe 100644 --- a/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py +++ b/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py @@ -27,6 +27,7 @@ UiPathBaseEmbeddings, ) from uipath_langchain_client.settings import ( + _API_FLAVOR_TO_VENDOR_TYPE, ApiFlavor, RoutingMode, UiPathBaseSettings, @@ -139,8 +140,14 @@ def get_chat_model( **model_kwargs, ) - discovered_vendor = model_info["vendor"].lower() - match discovered_vendor: + discovered_vendor_type = model_info.get("vendor", None) + discovered_api_flavor = model_info.get("apiFlavor", None) + if discovered_api_flavor is None and discovered_vendor_type is None: + raise ValueError("No vendor type or api flavor found in model info") + if discovered_vendor_type is None and discovered_api_flavor is not None: + discovered_vendor_type = _API_FLAVOR_TO_VENDOR_TYPE[ApiFlavor(discovered_api_flavor)] + + match discovered_vendor_type: case VendorType.OPENAI: if api_flavor == ApiFlavor.RESPONSES: model_kwargs["use_responses_api"] = True @@ -176,7 +183,7 @@ def get_chat_model( return UiPathChatAnthropic( model=model_name, settings=client_settings, - vendor_type=discovered_vendor, + vendor_type=discovered_vendor_type, byo_connection_id=byo_connection_id, **model_kwargs, ) @@ -229,7 +236,7 @@ def get_chat_model( case _: raise ValueError( - f"Invalid vendor type: {discovered_vendor}, we don't currently have clients that support this vendor" + f"Invalid vendor type: {discovered_vendor_type}, we don't currently have clients that support this vendor" ) @@ -290,8 +297,8 @@ def get_embedding_model( **model_kwargs, ) - discovered_vendor = model_info["vendor"].lower() - match discovered_vendor: + discovered_vendor_type = model_info["vendor"].lower() + match discovered_vendor_type: case VendorType.OPENAI: if is_uipath_owned: from uipath_langchain_client.clients.openai.embeddings import ( @@ -340,5 +347,5 @@ def get_embedding_model( ) case _: raise ValueError( - f"Invalid vendor type: {discovered_vendor}, we don't currently have clients that support this vendor" + f"Invalid vendor type: {discovered_vendor_type}, we don't currently have clients that support this vendor" ) diff --git a/packages/uipath_langchain_client/src/uipath_langchain_client/settings.py b/packages/uipath_langchain_client/src/uipath_langchain_client/settings.py index c255f2b..e8fc87a 100644 --- a/packages/uipath_langchain_client/src/uipath_langchain_client/settings.py +++ b/packages/uipath_langchain_client/src/uipath_langchain_client/settings.py @@ -22,7 +22,13 @@ UiPathBaseSettings, get_default_client_settings, ) -from uipath.llm_client.settings.constants import ApiFlavor, ApiType, RoutingMode, VendorType +from uipath.llm_client.settings.constants import ( + _API_FLAVOR_TO_VENDOR_TYPE, + ApiFlavor, + ApiType, + RoutingMode, + VendorType, +) __all__ = [ "get_default_client_settings", @@ -34,4 +40,5 @@ "RoutingMode", "ApiFlavor", "VendorType", + "_API_FLAVOR_TO_VENDOR_TYPE", ] diff --git a/src/uipath/llm_client/__version__.py b/src/uipath/llm_client/__version__.py index 418bec6..62f4e36 100644 --- a/src/uipath/llm_client/__version__.py +++ b/src/uipath/llm_client/__version__.py @@ -1,3 +1,3 @@ __title__ = "UiPath LLM Client" __description__ = "A Python client for interacting with UiPath's LLM services." -__version__ = "1.5.6" +__version__ = "1.5.7" diff --git a/src/uipath/llm_client/settings/constants.py b/src/uipath/llm_client/settings/constants.py index f5ef27d..27232ca 100644 --- a/src/uipath/llm_client/settings/constants.py +++ b/src/uipath/llm_client/settings/constants.py @@ -26,3 +26,13 @@ class ApiFlavor(StrEnum): CONVERSE = "converse" INVOKE = "invoke" ANTHROPIC_CLAUDE = "anthropic-claude" + + +_API_FLAVOR_TO_VENDOR_TYPE: dict[ApiFlavor, VendorType] = { + ApiFlavor.CHAT_COMPLETIONS: VendorType.OPENAI, + ApiFlavor.RESPONSES: VendorType.OPENAI, + ApiFlavor.GENERATE_CONTENT: VendorType.VERTEXAI, + ApiFlavor.ANTHROPIC_CLAUDE: VendorType.VERTEXAI, + ApiFlavor.CONVERSE: VendorType.AWSBEDROCK, + ApiFlavor.INVOKE: VendorType.AWSBEDROCK, +} From 83c410383cf817de89304c83bb3b06a6777c2f14 Mon Sep 17 00:00:00 2001 From: Cosmin Maria Date: Mon, 23 Mar 2026 14:52:07 +0200 Subject: [PATCH 2/2] fixes --- .../src/uipath_langchain_client/factory.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py b/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py index 71275fe..9a5804b 100644 --- a/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py +++ b/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py @@ -142,10 +142,11 @@ def get_chat_model( discovered_vendor_type = model_info.get("vendor", None) discovered_api_flavor = model_info.get("apiFlavor", None) - if discovered_api_flavor is None and discovered_vendor_type is None: - raise ValueError("No vendor type or api flavor found in model info") if discovered_vendor_type is None and discovered_api_flavor is not None: - discovered_vendor_type = _API_FLAVOR_TO_VENDOR_TYPE[ApiFlavor(discovered_api_flavor)] + discovered_vendor_type = _API_FLAVOR_TO_VENDOR_TYPE.get(discovered_api_flavor, None) + if discovered_vendor_type is None: + raise ValueError("No vendor type or api flavor found in model info") + discovered_vendor_type = discovered_vendor_type.lower() match discovered_vendor_type: case VendorType.OPENAI: