Skip to content

Commit a789597

Browse files
committed
fix: forward agenthub_config to upstream factory on new-clients path
1 parent cfca287 commit a789597

4 files changed

Lines changed: 73 additions & 22 deletions

File tree

pyproject.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-langchain"
3-
version = "0.10.18"
3+
version = "0.10.19"
44
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"
@@ -23,7 +23,7 @@ dependencies = [
2323
"langchain-mcp-adapters==0.2.1",
2424
"pillow>=12.1.1",
2525
"a2a-sdk>=0.2.0,<1.0.0",
26-
"uipath-langchain-client[openai]>=1.10.0,<1.11.0",
26+
"uipath-langchain-client[openai]>=1.10.1,<1.11.0",
2727
]
2828

2929
classifiers = [
@@ -40,21 +40,21 @@ maintainers = [
4040

4141
[project.optional-dependencies]
4242
anthropic = [
43-
"uipath-langchain-client[anthropic]>=1.10.0,<1.11.0",
43+
"uipath-langchain-client[anthropic]>=1.10.1,<1.11.0",
4444
]
4545
vertex = [
46-
"uipath-langchain-client[google]>=1.10.0,<1.11.0",
47-
"uipath-langchain-client[vertexai]>=1.10.0,<1.11.0",
46+
"uipath-langchain-client[google]>=1.10.1,<1.11.0",
47+
"uipath-langchain-client[vertexai]>=1.10.1,<1.11.0",
4848
]
4949
bedrock = [
50-
"uipath-langchain-client[bedrock]>=1.10.0,<1.11.0",
50+
"uipath-langchain-client[bedrock]>=1.10.1,<1.11.0",
5151
"boto3-stubs>=1.41.4",
5252
]
5353
fireworks = [
54-
"uipath-langchain-client[fireworks]>=1.10.0,<1.11.0",
54+
"uipath-langchain-client[fireworks]>=1.10.1,<1.11.0",
5555
]
5656
all = [
57-
"uipath-langchain-client[all]>=1.10.0,<1.11.0",
57+
"uipath-langchain-client[all]>=1.10.1,<1.11.0",
5858
]
5959

6060
[project.entry-points."uipath.middlewares"]

src/uipath_langchain/chat/chat_model_factory.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def get_chat_model(
4444
timeout: float | None = DEFAULT_TIMEOUT_SECONDS,
4545
max_retries: int | None = DEFAULT_MAX_RETRIES,
4646
callbacks: Callbacks = _UNSET,
47-
# Legacy-only arguments
4847
agenthub_config: str | None = None,
4948
use_new_llm_clients: bool = True,
5049
**kwargs: Any,
@@ -73,8 +72,10 @@ def get_chat_model(
7372
returned chat model. Accepts ``list[BaseCallbackHandler]`` or a
7473
``BaseCallbackManager``. Forwarded only when explicitly set.
7574
Ignored by the legacy factory.
76-
agenthub_config: AgentHub config header value. Required by the legacy
77-
factory; ignored by the new factory.
75+
agenthub_config: AgentHub config header value. Forwarded to the new
76+
factory, which applies it on top of ``client_settings.agenthub_config``
77+
via ``model_copy`` (caller's settings instance is not mutated).
78+
Required by the legacy factory.
7879
use_new_llm_clients: Routes to the new ``uipath_langchain_client``
7980
factory when True (default). When False, routes to the legacy
8081
in-repo clients.
@@ -115,6 +116,7 @@ def get_chat_model(
115116
vendor_type=vendor_type,
116117
api_flavor=api_flavor,
117118
custom_class=custom_class,
119+
agenthub_config=agenthub_config,
118120
**optional_kwargs,
119121
**kwargs,
120122
)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"""Tests that ``chat_model_factory.get_chat_model`` forwards ``agenthub_config``
2+
to the upstream ``uipath_langchain_client`` factory on the new-clients path.
3+
4+
Without this, low-code agent runtimes computed the right value
5+
(``agentsplayground`` for debug, ``agentsruntime`` for run, …) but every LLM
6+
gateway request shipped the upstream default ``agentsruntime`` because the
7+
parameter was silently dropped before delegating.
8+
"""
9+
10+
from unittest.mock import MagicMock
11+
12+
import pytest
13+
14+
from uipath_langchain.chat.chat_model_factory import get_chat_model
15+
16+
17+
class TestForwardAgentHubConfig:
18+
def test_agenthub_config_forwarded_on_new_path(self, mocker):
19+
"""The kwarg the caller passes must reach the upstream factory verbatim."""
20+
upstream = mocker.patch(
21+
"uipath_langchain.chat.chat_model_factory.get_chat_model_factory",
22+
return_value=MagicMock(),
23+
)
24+
25+
get_chat_model(
26+
"gpt-4o",
27+
agenthub_config="agentsplayground",
28+
use_new_llm_clients=True,
29+
)
30+
31+
_, kwargs = upstream.call_args
32+
assert kwargs.get("agenthub_config") == "agentsplayground"
33+
34+
def test_agenthub_config_none_forwarded_on_new_path(self, mocker):
35+
"""Pass-through preserves None so upstream applies its own default."""
36+
upstream = mocker.patch(
37+
"uipath_langchain.chat.chat_model_factory.get_chat_model_factory",
38+
return_value=MagicMock(),
39+
)
40+
41+
get_chat_model("gpt-4o", use_new_llm_clients=True)
42+
43+
_, kwargs = upstream.call_args
44+
assert kwargs.get("agenthub_config") is None
45+
46+
def test_legacy_path_still_requires_agenthub_config(self, mocker):
47+
"""Legacy factory contract is unchanged: missing agenthub_config raises."""
48+
with pytest.raises(ValueError, match="agenthub_config is required"):
49+
get_chat_model("gpt-4o", use_new_llm_clients=False)

uv.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)