Skip to content

Commit 5a721cd

Browse files
authored
fix: byom fix to select vendor based on api flavor (#48)
1 parent aa95673 commit 5a721cd

8 files changed

Lines changed: 46 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to `uipath_llm_client` (core package) will be documented in this file.
44

5+
## [1.5.7] - 2026-03-23
6+
7+
### Fix
8+
- Added mapping api_flavor to vendor_type
9+
510
## [1.5.6] - 2026-03-21
611

712
### Feature

packages/uipath_langchain_client/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to `uipath_langchain_client` will be documented in this file.
44

5+
## [1.5.7] - 2026-03-23
6+
7+
### Fix
8+
- Fix factory for BYO to handle the case where vendor_type is None, but api_flavor is discovered
9+
510
## [1.5.6] - 2026-03-21
611

712
### Feature

packages/uipath_langchain_client/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "README.md"
66
requires-python = ">=3.11"
77
dependencies = [
88
"langchain>=1.2.13",
9-
"uipath-llm-client>=1.5.6",
9+
"uipath-llm-client>=1.5.7",
1010
]
1111

1212
[project.optional-dependencies]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__title__ = "UiPath LangChain Client"
22
__description__ = "A Python client for interacting with UiPath's LLM services via LangChain."
3-
__version__ = "1.5.6"
3+
__version__ = "1.5.7"

packages/uipath_langchain_client/src/uipath_langchain_client/factory.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
UiPathBaseEmbeddings,
2828
)
2929
from uipath_langchain_client.settings import (
30+
_API_FLAVOR_TO_VENDOR_TYPE,
3031
ApiFlavor,
3132
RoutingMode,
3233
UiPathBaseSettings,
@@ -139,8 +140,15 @@ def get_chat_model(
139140
**model_kwargs,
140141
)
141142

142-
discovered_vendor = model_info["vendor"].lower()
143-
match discovered_vendor:
143+
discovered_vendor_type = model_info.get("vendor", None)
144+
discovered_api_flavor = model_info.get("apiFlavor", None)
145+
if discovered_vendor_type is None and discovered_api_flavor is not None:
146+
discovered_vendor_type = _API_FLAVOR_TO_VENDOR_TYPE.get(discovered_api_flavor, None)
147+
if discovered_vendor_type is None:
148+
raise ValueError("No vendor type or api flavor found in model info")
149+
discovered_vendor_type = discovered_vendor_type.lower()
150+
151+
match discovered_vendor_type:
144152
case VendorType.OPENAI:
145153
if api_flavor == ApiFlavor.RESPONSES:
146154
model_kwargs["use_responses_api"] = True
@@ -176,7 +184,7 @@ def get_chat_model(
176184
return UiPathChatAnthropic(
177185
model=model_name,
178186
settings=client_settings,
179-
vendor_type=discovered_vendor,
187+
vendor_type=discovered_vendor_type,
180188
byo_connection_id=byo_connection_id,
181189
**model_kwargs,
182190
)
@@ -229,7 +237,7 @@ def get_chat_model(
229237

230238
case _:
231239
raise ValueError(
232-
f"Invalid vendor type: {discovered_vendor}, we don't currently have clients that support this vendor"
240+
f"Invalid vendor type: {discovered_vendor_type}, we don't currently have clients that support this vendor"
233241
)
234242

235243

@@ -290,8 +298,8 @@ def get_embedding_model(
290298
**model_kwargs,
291299
)
292300

293-
discovered_vendor = model_info["vendor"].lower()
294-
match discovered_vendor:
301+
discovered_vendor_type = model_info["vendor"].lower()
302+
match discovered_vendor_type:
295303
case VendorType.OPENAI:
296304
if is_uipath_owned:
297305
from uipath_langchain_client.clients.openai.embeddings import (
@@ -340,5 +348,5 @@ def get_embedding_model(
340348
)
341349
case _:
342350
raise ValueError(
343-
f"Invalid vendor type: {discovered_vendor}, we don't currently have clients that support this vendor"
351+
f"Invalid vendor type: {discovered_vendor_type}, we don't currently have clients that support this vendor"
344352
)

packages/uipath_langchain_client/src/uipath_langchain_client/settings.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
UiPathBaseSettings,
2323
get_default_client_settings,
2424
)
25-
from uipath.llm_client.settings.constants import ApiFlavor, ApiType, RoutingMode, VendorType
25+
from uipath.llm_client.settings.constants import (
26+
_API_FLAVOR_TO_VENDOR_TYPE,
27+
ApiFlavor,
28+
ApiType,
29+
RoutingMode,
30+
VendorType,
31+
)
2632

2733
__all__ = [
2834
"get_default_client_settings",
@@ -34,4 +40,5 @@
3440
"RoutingMode",
3541
"ApiFlavor",
3642
"VendorType",
43+
"_API_FLAVOR_TO_VENDOR_TYPE",
3744
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__title__ = "UiPath LLM Client"
22
__description__ = "A Python client for interacting with UiPath's LLM services."
3-
__version__ = "1.5.6"
3+
__version__ = "1.5.7"

src/uipath/llm_client/settings/constants.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@ class ApiFlavor(StrEnum):
2626
CONVERSE = "converse"
2727
INVOKE = "invoke"
2828
ANTHROPIC_CLAUDE = "anthropic-claude"
29+
30+
31+
_API_FLAVOR_TO_VENDOR_TYPE: dict[ApiFlavor, VendorType] = {
32+
ApiFlavor.CHAT_COMPLETIONS: VendorType.OPENAI,
33+
ApiFlavor.RESPONSES: VendorType.OPENAI,
34+
ApiFlavor.GENERATE_CONTENT: VendorType.VERTEXAI,
35+
ApiFlavor.ANTHROPIC_CLAUDE: VendorType.VERTEXAI,
36+
ApiFlavor.CONVERSE: VendorType.AWSBEDROCK,
37+
ApiFlavor.INVOKE: VendorType.AWSBEDROCK,
38+
}

0 commit comments

Comments
 (0)