uipath-llm-client 1.0.0__py3-none-any.whl → 1.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  __titile__ = "UiPath LLM Client"
2
2
  __description__ = "A Python client for interacting with UiPath's LLM services."
3
- __version__ = "1.0.0"
3
+ __version__ = "1.0.2"
@@ -193,7 +193,7 @@ class UiPathHttpxClient(Client):
193
193
  Response with patched raise_for_status() that raises UiPath exceptions.
194
194
  """
195
195
  if self._freeze_base_url:
196
- request.url = URL(self.base_url)
196
+ request.url = URL(str(self.base_url).rstrip("/"))
197
197
  request.headers[self._streaming_header] = str(stream).lower()
198
198
  response = super().send(request, stream=stream, **kwargs)
199
199
  return patch_raise_for_status(response)
@@ -313,7 +313,7 @@ class UiPathHttpxAsyncClient(AsyncClient):
313
313
  Response with patched raise_for_status() that raises UiPath exceptions.
314
314
  """
315
315
  if self._freeze_base_url:
316
- request.url = URL(self.base_url)
316
+ request.url = URL(str(self.base_url).rstrip("/"))
317
317
  request.headers[self._streaming_header] = str(stream).lower()
318
318
  response = await super().send(request, stream=stream, **kwargs)
319
319
  return patch_raise_for_status(response)
@@ -8,8 +8,8 @@ from dotenv import load_dotenv
8
8
  from pydantic import Field, SecretStr, model_validator
9
9
  from pydantic_settings import SettingsConfigDict
10
10
  from uipath._cli._auth._auth_service import AuthService
11
+ from uipath.utils import EndpointManager
11
12
 
12
- from uipath_llm_client.settings.agenthub.utils import AgentHubEndpoints
13
13
  from uipath_llm_client.settings.base import UiPathAPIConfig, UiPathBaseSettings
14
14
 
15
15
 
@@ -99,13 +99,16 @@ class AgentHubBaseSettings(UiPathBaseSettings):
99
99
  api_config: UiPathAPIConfig | None = None,
100
100
  ) -> str:
101
101
  """Build the base URL for API requests."""
102
- if api_config is not None and api_config.client_type == "normalized":
103
- url = f"{self.base_url}/{AgentHubEndpoints.NORMALIZED_ENDPOINT.value.format(api_type=api_config.api_type)}"
102
+ assert model_name is not None
103
+ assert api_config is not None
104
+ if api_config.client_type == "normalized" and api_config.api_type == "completions":
105
+ url = f"{self.base_url}/{EndpointManager.get_normalized_endpoint()}"
106
+ elif api_config.client_type == "passthrough" and api_config.api_type == "embeddings":
107
+ assert api_config.api_version is not None
108
+ url = f"{self.base_url}/{EndpointManager.get_embeddings_endpoint().format(model=model_name, api_version=api_config.api_version)}"
104
109
  else:
105
- assert api_config is not None
106
- assert api_config.api_type is not None
107
110
  assert api_config.vendor_type is not None
108
- url = f"{self.base_url}/{AgentHubEndpoints.PASSTHROUGH_ENDPOINT.value.format(model=model_name, vendor=api_config.vendor_type, api_type=api_config.api_type)}"
111
+ url = f"{self.base_url}/{EndpointManager.get_vendor_endpoint().format(model=model_name, vendor=api_config.vendor_type)}"
109
112
  return url
110
113
 
111
114
  @override
@@ -1,11 +1,11 @@
1
1
  from collections.abc import Generator
2
2
 
3
- from httpx import Auth, Client, HTTPStatusError, Request, Response
3
+ from httpx import Auth, Client, Request, Response
4
4
 
5
5
  from uipath_llm_client.settings.llmgateway.settings import LLMGatewayBaseSettings
6
6
  from uipath_llm_client.settings.llmgateway.utils import LLMGatewayEndpoints
7
7
  from uipath_llm_client.settings.utils import SingletonMeta
8
- from uipath_llm_client.utils.exceptions import UiPathAPIError
8
+ from uipath_llm_client.utils.exceptions import UiPathAPIError, UiPathAuthenticationError
9
9
 
10
10
 
11
11
  class LLMGatewayS2SAuth(Auth, metaclass=SingletonMeta):
@@ -39,10 +39,15 @@ class LLMGatewayS2SAuth(Auth, metaclass=SingletonMeta):
39
39
  )
40
40
  with Client() as http_client:
41
41
  response = http_client.post(url_get_token, data=token_credentials)
42
- try:
43
- response.raise_for_status()
44
- except HTTPStatusError as e:
45
- raise UiPathAPIError.from_response(e.response)
42
+ if response.is_client_error:
43
+ raise UiPathAuthenticationError(
44
+ message="Failed to authenticate with LLM Gateway, invalid credentials",
45
+ request=response.request,
46
+ response=response,
47
+ body=response.json(),
48
+ )
49
+ elif response.is_error:
50
+ raise UiPathAPIError.from_response(response)
46
51
  llmgw_token_header = response.json().get("access_token")
47
52
  return llmgw_token_header
48
53
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath-llm-client
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: UiPath LLM Client
5
5
  Author-email: Cosmin Maria <cosmin.maria@uipath.com>, Dragos Bobolea <dragos.bobolea@uipath.com>
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  uipath_llm_client/__init__.py,sha256=K7pMecLOblh6GWVBkoOalC-ho5ozlw3WG6loiJNzSFo,2363
2
- uipath_llm_client/__version__.py,sha256=i-3gbkh2cjfZHmW7rn8P-fH6H8bytkCMMV7yK6auN6g,135
3
- uipath_llm_client/httpx_client.py,sha256=IscG5Qu5E60FooEktOmNVIjjBGBJoA6APNCabmSFSnA,12718
2
+ uipath_llm_client/__version__.py,sha256=1nCovE7VmxdZ4cjSkRaZ6kp9WIZbQeEyQ6owNU7xYec,135
3
+ uipath_llm_client/httpx_client.py,sha256=F7fDgbTOImu4zWehUAxlqXhOysnGyfmB_58wm53YLlE,12752
4
4
  uipath_llm_client/clients/anthropic/__init__.py,sha256=0KxbVGKSVWwC89PYPM7IXkP3qhJa2J0zyW6xsr0efWM,546
5
5
  uipath_llm_client/clients/anthropic/client.py,sha256=UjrXzsgOOgoIRjo7SiLThWtXAJIEH-BHuPy3umNcmC0,17967
6
6
  uipath_llm_client/clients/google/__init__.py,sha256=_JRzU_RdUnWvpPdeAOpWjUb-ccN2TBcReXCFF34Ouyw,100
@@ -13,16 +13,15 @@ uipath_llm_client/settings/base.py,sha256=rVloAQCvbhY-bBdKEOH5WuB-pay91BZ9gpNXT0
13
13
  uipath_llm_client/settings/utils.py,sha256=2Rmr7RiQjRchSDHg46tuFRV5scEDphIl-NMkmyPScwo,466
14
14
  uipath_llm_client/settings/agenthub/__init__.py,sha256=3aBfGa4YkfeylXGBALF-BFktakYRlideFajhvfq8YlQ,1538
15
15
  uipath_llm_client/settings/agenthub/auth.py,sha256=vWb0nipR3pITNxVQmQARCsxx5ZfUAfWS_SR5w0A7dEo,1591
16
- uipath_llm_client/settings/agenthub/settings.py,sha256=-tNiyg_AeKKNa-m2T2DG596eoCUayJrB-6KUswHncgo,5764
17
- uipath_llm_client/settings/agenthub/utils.py,sha256=JVpGC8SKNshCz_MCp-wcjPGTpGWTdP0TPXcPs5kDEH4,471
16
+ uipath_llm_client/settings/agenthub/settings.py,sha256=Dr9hg6PeR2pjYamq-ERH88oXbjUXL6x6_6KpqkdUQck,5944
18
17
  uipath_llm_client/settings/llmgateway/__init__.py,sha256=QMViUqELA0LVle_WDjNivxxNaFSpr_X3yfJRsCEdZ4I,1525
19
- uipath_llm_client/settings/llmgateway/auth.py,sha256=BxZZtLvHCiFaNouS7eyYfO9GHKUllJMnVtxaPPHvClA,2441
18
+ uipath_llm_client/settings/llmgateway/auth.py,sha256=JzN6czbLOQfLF0CMuHNHJjzUOSzKfr_tVrgeC5tXSxI,2710
20
19
  uipath_llm_client/settings/llmgateway/settings.py,sha256=ZhKk94UP2yJ6MNR8mSRWmoqYB_pRv9SKmV3OWVh0CWY,4733
21
20
  uipath_llm_client/settings/llmgateway/utils.py,sha256=gqyZXulcG0ifvlaxqdOGkf24jOtjCAalBme26BmoV3Q,527
22
21
  uipath_llm_client/utils/exceptions.py,sha256=IcHPQIf-Jzir_rG7gaD7ByD25Thcl-QpAjnC6xvZ0qQ,5973
23
22
  uipath_llm_client/utils/logging.py,sha256=pmC00QAt4LVXFb6PCHQDPoX7iLE9N2GeEytuAkUiQ1w,4641
24
23
  uipath_llm_client/utils/retry.py,sha256=cvM-OBEvga6mufCQ5G9rmxVzd33wOJOO6UGOHs9IWgk,8603
25
- uipath_llm_client-1.0.0.dist-info/METADATA,sha256=BcAbGn1ItN0S6gQI9ZwuSRPXgJ9fgmoaSTl-5snnJZU,22964
26
- uipath_llm_client-1.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
27
- uipath_llm_client-1.0.0.dist-info/licenses/LICENSE,sha256=r4HMU0pdnVI7BlSYgDUCszn7IrCXJiN8o3yt2U1aOpc,375
28
- uipath_llm_client-1.0.0.dist-info/RECORD,,
24
+ uipath_llm_client-1.0.2.dist-info/METADATA,sha256=7-_NIxmbpl2cBfqPDLIa8_ae_ZvzDNPE7qDJE83sSSY,22964
25
+ uipath_llm_client-1.0.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
26
+ uipath_llm_client-1.0.2.dist-info/licenses/LICENSE,sha256=r4HMU0pdnVI7BlSYgDUCszn7IrCXJiN8o3yt2U1aOpc,375
27
+ uipath_llm_client-1.0.2.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- """Utility classes for AgentHub settings."""
2
-
3
- from enum import StrEnum
4
-
5
-
6
- class AgentHubEndpoints(StrEnum):
7
- """API endpoint paths for UiPath AgentHub.
8
-
9
- Normalized endpoints provide a consistent API across all providers.
10
- Passthrough endpoints expose vendor-specific APIs with formats for vendor/model.
11
- """
12
-
13
- NORMALIZED_ENDPOINT = "agenthub_/llm/api/chat/{api_type}"
14
- PASSTHROUGH_ENDPOINT = "agenthub_/llm/raw/vendor/{vendor}/model/{model}/{api_type}"