|
1 | | -"""Tests for the chat-client agenthub_config default behavior. |
2 | | -
|
3 | | -Direct construction of UiPathChat / UiPathChatOpenAI / UiPathAzureChatOpenAI / |
4 | | -UiPathChatBedrock / UiPathChatBedrockConverse / UiPathChatAnthropicBedrock / |
5 | | -UiPathChatGoogleGenerativeAI / UiPathChatVertex must default |
6 | | -client_settings.agenthub_config to None. |
7 | | -
|
8 | | -The upstream classes (used by chat_model_factory for low-code runtime) |
9 | | -must keep the upstream library default of "agentsruntime", proving the |
10 | | -local override does not leak globally onto the upstream class. |
11 | | -""" |
| 1 | +"""Tests that direct construction of UiPathChat / UiPathChatOpenAI / |
| 2 | +UiPathAzureChatOpenAI / UiPathChatBedrock / UiPathChatBedrockConverse / |
| 3 | +UiPathChatAnthropicBedrock / UiPathChatGoogleGenerativeAI / UiPathChatVertex |
| 4 | +defaults ``client_settings.agenthub_config`` to None and omits the |
| 5 | +``x-uipath-agenthub-config`` header on the outgoing httpx client unless |
| 6 | +``UIPATH_AGENTHUB_CONFIG`` is set.""" |
12 | 7 |
|
13 | 8 | import pytest |
14 | 9 |
|
@@ -78,35 +73,3 @@ def test_env_var_is_honored_on_inner_http_client(self, cls, monkeypatch): |
78 | 73 | pytest.skip(f"{cls.__name__} has no uipath_sync_client to inspect") |
79 | 74 | normalized = {key.lower(): value for key, value in client.headers.items()} |
80 | 75 | assert normalized.get("x-uipath-agenthub-config") == "agentsplayground" |
81 | | - |
82 | | - |
83 | | -_UPSTREAM_CASES = [ |
84 | | - "uipath_langchain_client.clients.normalized.chat_models:UiPathChat", |
85 | | - "uipath_langchain_client.clients.openai.chat_models:UiPathChatOpenAI", |
86 | | - "uipath_langchain_client.clients.openai.chat_models:UiPathAzureChatOpenAI", |
87 | | - "uipath_langchain_client.clients.bedrock.chat_models:UiPathChatBedrock", |
88 | | - "uipath_langchain_client.clients.bedrock.chat_models:UiPathChatBedrockConverse", |
89 | | - "uipath_langchain_client.clients.bedrock.chat_models:UiPathChatAnthropicBedrock", |
90 | | - "uipath_langchain_client.clients.google.chat_models:UiPathChatGoogleGenerativeAI", |
91 | | -] |
92 | | - |
93 | | - |
94 | | -@pytest.mark.parametrize("upstream_path", _UPSTREAM_CASES) |
95 | | -class TestUpstreamAgentHubConfigUntouched: |
96 | | - """Deployed runtimes go through chat_model_factory, which instantiates the |
97 | | - upstream classes directly. Those must keep the upstream library default of |
98 | | - 'agentsruntime'.""" |
99 | | - |
100 | | - def _resolve(self, upstream_path: str): |
101 | | - import importlib |
102 | | - |
103 | | - module_name, attr = upstream_path.split(":") |
104 | | - return getattr(importlib.import_module(module_name), attr) |
105 | | - |
106 | | - def test_upstream_keeps_agentsruntime_default(self, upstream_path): |
107 | | - # make sure model rebinds are not breaking the agenthub_config |
108 | | - import uipath_langchain.chat # noqa: F401 |
109 | | - |
110 | | - upstream_cls = self._resolve(upstream_path) |
111 | | - llm = upstream_cls(model="gpt-4.1-mini-2025-04-14") |
112 | | - assert llm.client_settings.agenthub_config == "agentsruntime" |
0 commit comments