uipath-llm-client 1.0.1__py3-none-any.whl → 1.0.3__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.
- uipath_llm_client/__version__.py +1 -1
- uipath_llm_client/httpx_client.py +3 -3
- uipath_llm_client/settings/agenthub/settings.py +9 -6
- uipath_llm_client/utils/ssl_config.py +54 -0
- {uipath_llm_client-1.0.1.dist-info → uipath_llm_client-1.0.3.dist-info}/METADATA +1 -1
- {uipath_llm_client-1.0.1.dist-info → uipath_llm_client-1.0.3.dist-info}/RECORD +8 -8
- uipath_llm_client/settings/agenthub/utils.py +0 -14
- {uipath_llm_client-1.0.1.dist-info → uipath_llm_client-1.0.3.dist-info}/WHEEL +0 -0
- {uipath_llm_client-1.0.1.dist-info → uipath_llm_client-1.0.3.dist-info}/licenses/LICENSE +0 -0
uipath_llm_client/__version__.py
CHANGED
|
@@ -35,7 +35,6 @@ from httpx import (
|
|
|
35
35
|
Response,
|
|
36
36
|
)
|
|
37
37
|
from httpx._types import HeaderTypes
|
|
38
|
-
from uipath._utils._ssl_context import get_httpx_client_kwargs
|
|
39
38
|
|
|
40
39
|
from uipath_llm_client.settings import (
|
|
41
40
|
UiPathAPIConfig,
|
|
@@ -47,6 +46,7 @@ from uipath_llm_client.utils.retry import (
|
|
|
47
46
|
RetryableHTTPTransport,
|
|
48
47
|
RetryConfig,
|
|
49
48
|
)
|
|
49
|
+
from uipath_llm_client.utils.ssl_config import get_httpx_client_kwargs
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
def build_routing_headers(
|
|
@@ -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
|
-
|
|
103
|
-
|
|
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}/{
|
|
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
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import ssl
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def expand_path(path):
|
|
7
|
+
"""Expand environment variables and user home directory in path."""
|
|
8
|
+
if not path:
|
|
9
|
+
return path
|
|
10
|
+
# Expand environment variables like $HOME
|
|
11
|
+
path = os.path.expandvars(path)
|
|
12
|
+
# Expand user home directory ~
|
|
13
|
+
path = os.path.expanduser(path)
|
|
14
|
+
return path
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def create_ssl_context():
|
|
18
|
+
# Try truststore first (system certificates)
|
|
19
|
+
try:
|
|
20
|
+
import truststore
|
|
21
|
+
|
|
22
|
+
return truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
|
23
|
+
except ImportError:
|
|
24
|
+
# Fallback to manual certificate configuration
|
|
25
|
+
import certifi
|
|
26
|
+
|
|
27
|
+
ssl_cert_file = expand_path(os.environ.get("SSL_CERT_FILE"))
|
|
28
|
+
requests_ca_bundle = expand_path(os.environ.get("REQUESTS_CA_BUNDLE"))
|
|
29
|
+
ssl_cert_dir = expand_path(os.environ.get("SSL_CERT_DIR"))
|
|
30
|
+
|
|
31
|
+
return ssl.create_default_context(
|
|
32
|
+
cafile=ssl_cert_file or requests_ca_bundle or certifi.where(),
|
|
33
|
+
capath=ssl_cert_dir,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_httpx_client_kwargs() -> dict[str, Any]:
|
|
38
|
+
"""Get standardized httpx client configuration."""
|
|
39
|
+
client_kwargs: dict[str, Any] = {"follow_redirects": True, "timeout": 30.0}
|
|
40
|
+
|
|
41
|
+
# Check environment variable to disable SSL verification
|
|
42
|
+
disable_ssl_env = os.environ.get("UIPATH_DISABLE_SSL_VERIFY", "").lower()
|
|
43
|
+
disable_ssl_from_env = disable_ssl_env in ("1", "true", "yes", "on")
|
|
44
|
+
|
|
45
|
+
if disable_ssl_from_env:
|
|
46
|
+
client_kwargs["verify"] = False
|
|
47
|
+
else:
|
|
48
|
+
# Use system certificates with truststore fallback
|
|
49
|
+
client_kwargs["verify"] = create_ssl_context()
|
|
50
|
+
|
|
51
|
+
# Auto-detect proxy from environment variables (httpx handles this automatically)
|
|
52
|
+
# HTTP_PROXY, HTTPS_PROXY, NO_PROXY are read by httpx by default
|
|
53
|
+
|
|
54
|
+
return client_kwargs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
uipath_llm_client/__init__.py,sha256=K7pMecLOblh6GWVBkoOalC-ho5ozlw3WG6loiJNzSFo,2363
|
|
2
|
-
uipath_llm_client/__version__.py,sha256=
|
|
3
|
-
uipath_llm_client/httpx_client.py,sha256=
|
|
2
|
+
uipath_llm_client/__version__.py,sha256=MlmzOSirL7w4RNOuT9_Z54kuvZOTZ4YXnsxVWwTrUR8,135
|
|
3
|
+
uipath_llm_client/httpx_client.py,sha256=yh9AT5_1jJzcrDfpfLmG3Th6r8Rps2zLwSTQMyI9lBg,12760
|
|
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,8 +13,7 @@ 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
|
|
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
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
|
|
@@ -22,7 +21,8 @@ uipath_llm_client/settings/llmgateway/utils.py,sha256=gqyZXulcG0ifvlaxqdOGkf24jO
|
|
|
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
|
|
26
|
-
uipath_llm_client-1.0.
|
|
27
|
-
uipath_llm_client-1.0.
|
|
28
|
-
uipath_llm_client-1.0.
|
|
24
|
+
uipath_llm_client/utils/ssl_config.py,sha256=N-XGdZ93bWLJLwgIHkI9YD58QiB6lzVvgNT97q0dmF8,1777
|
|
25
|
+
uipath_llm_client-1.0.3.dist-info/METADATA,sha256=UKoUMKlX-LC5FtFERWW4ESUXPckj5iRmnmlnWQVPi3Y,22964
|
|
26
|
+
uipath_llm_client-1.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
27
|
+
uipath_llm_client-1.0.3.dist-info/licenses/LICENSE,sha256=r4HMU0pdnVI7BlSYgDUCszn7IrCXJiN8o3yt2U1aOpc,375
|
|
28
|
+
uipath_llm_client-1.0.3.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}"
|
|
File without changes
|
|
File without changes
|