uipath 2.1.132__py3-none-any.whl → 2.1.133__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.
Potentially problematic release.
This version of uipath might be problematic. Click here for more details.
- uipath/utils/_endpoints_manager.py +184 -196
- {uipath-2.1.132.dist-info → uipath-2.1.133.dist-info}/METADATA +1 -1
- {uipath-2.1.132.dist-info → uipath-2.1.133.dist-info}/RECORD +6 -6
- {uipath-2.1.132.dist-info → uipath-2.1.133.dist-info}/WHEEL +0 -0
- {uipath-2.1.132.dist-info → uipath-2.1.133.dist-info}/entry_points.txt +0 -0
- {uipath-2.1.132.dist-info → uipath-2.1.133.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,196 +1,184 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import os
|
|
3
|
-
from enum import Enum
|
|
4
|
-
from typing import Optional
|
|
5
|
-
|
|
6
|
-
import httpx
|
|
7
|
-
|
|
8
|
-
from uipath._utils._ssl_context import get_httpx_client_kwargs
|
|
9
|
-
|
|
10
|
-
loggger = logging.getLogger(__name__)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class UiPathEndpoints(Enum):
|
|
14
|
-
AH_NORMALIZED_COMPLETION_ENDPOINT = "agenthub_/llm/api/chat/completions"
|
|
15
|
-
AH_PASSTHROUGH_COMPLETION_ENDPOINT = "agenthub_/llm/openai/deployments/{model}/chat/completions?api-version={api_version}"
|
|
16
|
-
AH_EMBEDDING_ENDPOINT = (
|
|
17
|
-
"agenthub_/llm/openai/deployments/{model}/embeddings?api-version={api_version}"
|
|
18
|
-
)
|
|
19
|
-
AH_CAPABILITIES_ENDPOINT = "agenthub_/llm/api/capabilities"
|
|
20
|
-
|
|
21
|
-
OR_NORMALIZED_COMPLETION_ENDPOINT = "orchestrator_/llm/api/chat/completions"
|
|
22
|
-
OR_PASSTHROUGH_COMPLETION_ENDPOINT = "orchestrator_/llm/openai/deployments/{model}/chat/completions?api-version={api_version}"
|
|
23
|
-
OR_EMBEDDING_ENDPOINT = "orchestrator_/llm/openai/deployments/{model}/embeddings?api-version={api_version}"
|
|
24
|
-
OR_CAPABILITIES_ENDPOINT = "orchestrator_/llm/api/capabilities"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"""
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
UiPathEndpoints.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
UiPathEndpoints.OR_NORMALIZED_COMPLETION_ENDPOINT,
|
|
186
|
-
UiPathEndpoints.LG_NORMALIZED_COMPLETION_ENDPOINT,
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
@classmethod
|
|
190
|
-
def get_embeddings_endpoint(cls) -> str:
|
|
191
|
-
"""Get the embeddings endpoint."""
|
|
192
|
-
return cls._select_endpoint(
|
|
193
|
-
UiPathEndpoints.AH_EMBEDDING_ENDPOINT,
|
|
194
|
-
UiPathEndpoints.OR_EMBEDDING_ENDPOINT,
|
|
195
|
-
UiPathEndpoints.LG_EMBEDDING_ENDPOINT,
|
|
196
|
-
)
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
from enum import Enum
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from uipath._utils._ssl_context import get_httpx_client_kwargs
|
|
9
|
+
|
|
10
|
+
loggger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class UiPathEndpoints(Enum):
|
|
14
|
+
AH_NORMALIZED_COMPLETION_ENDPOINT = "agenthub_/llm/api/chat/completions"
|
|
15
|
+
AH_PASSTHROUGH_COMPLETION_ENDPOINT = "agenthub_/llm/openai/deployments/{model}/chat/completions?api-version={api_version}"
|
|
16
|
+
AH_EMBEDDING_ENDPOINT = (
|
|
17
|
+
"agenthub_/llm/openai/deployments/{model}/embeddings?api-version={api_version}"
|
|
18
|
+
)
|
|
19
|
+
AH_CAPABILITIES_ENDPOINT = "agenthub_/llm/api/capabilities"
|
|
20
|
+
|
|
21
|
+
OR_NORMALIZED_COMPLETION_ENDPOINT = "orchestrator_/llm/api/chat/completions"
|
|
22
|
+
OR_PASSTHROUGH_COMPLETION_ENDPOINT = "orchestrator_/llm/openai/deployments/{model}/chat/completions?api-version={api_version}"
|
|
23
|
+
OR_EMBEDDING_ENDPOINT = "orchestrator_/llm/openai/deployments/{model}/embeddings?api-version={api_version}"
|
|
24
|
+
OR_CAPABILITIES_ENDPOINT = "orchestrator_/llm/api/capabilities"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class EndpointManager:
|
|
28
|
+
"""Manages and caches the UiPath endpoints.
|
|
29
|
+
This class provides functionality to determine which UiPath endpoints to use based on
|
|
30
|
+
the availability of AgentHub and Orchestrator. It checks for capabilities and caches
|
|
31
|
+
the results to avoid repeated network calls.
|
|
32
|
+
|
|
33
|
+
The endpoint selection follows a fallback order:
|
|
34
|
+
1. AgentHub (if available)
|
|
35
|
+
2. Orchestrator (if available)
|
|
36
|
+
|
|
37
|
+
Environment Variable Override:
|
|
38
|
+
The fallback behavior can be bypassed using the UIPATH_LLM_SERVICE environment variable:
|
|
39
|
+
- 'agenthub' or 'ah': Force use of AgentHub endpoints (skips capability checks)
|
|
40
|
+
- 'orchestrator' or 'or': Force use of Orchestrator endpoints (skips capability checks)
|
|
41
|
+
|
|
42
|
+
Class Attributes:
|
|
43
|
+
_base_url (str): The base URL for UiPath services, retrieved from the UIPATH_URL
|
|
44
|
+
environment variable.
|
|
45
|
+
_agenthub_available (Optional[bool]): Cached result of AgentHub availability check.
|
|
46
|
+
_orchestrator_available (Optional[bool]): Cached result of Orchestrator availability check.
|
|
47
|
+
|
|
48
|
+
Methods:
|
|
49
|
+
is_agenthub_available(): Checks if AgentHub is available, caching the result.
|
|
50
|
+
is_orchestrator_available(): Checks if Orchestrator is available, caching the result.
|
|
51
|
+
get_passthrough_endpoint(): Returns the appropriate passthrough completion endpoint.
|
|
52
|
+
get_normalized_endpoint(): Returns the appropriate normalized completion endpoint.
|
|
53
|
+
get_embeddings_endpoint(): Returns the appropriate embeddings endpoint.
|
|
54
|
+
All endpoint methods automatically select the best available endpoint using the fallback order,
|
|
55
|
+
unless overridden by the UIPATH_LLM_SERVICE environment variable.
|
|
56
|
+
""" # noqa: D205
|
|
57
|
+
|
|
58
|
+
_base_url = os.getenv("UIPATH_URL", "")
|
|
59
|
+
_agenthub_available: Optional[bool] = None
|
|
60
|
+
_orchestrator_available: Optional[bool] = None
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def is_agenthub_available(cls) -> bool:
|
|
64
|
+
"""Check if AgentHub is available and cache the result."""
|
|
65
|
+
if cls._agenthub_available is None:
|
|
66
|
+
cls._agenthub_available = cls._check_agenthub()
|
|
67
|
+
return cls._agenthub_available
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def is_orchestrator_available(cls) -> bool:
|
|
71
|
+
"""Check if Orchestrator is available and cache the result."""
|
|
72
|
+
if cls._orchestrator_available is None:
|
|
73
|
+
cls._orchestrator_available = cls._check_orchestrator()
|
|
74
|
+
return cls._orchestrator_available
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def _check_capabilities(cls, endpoint: UiPathEndpoints, service_name: str) -> bool:
|
|
78
|
+
"""Perform the actual check for service capabilities.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
endpoint: The capabilities endpoint to check
|
|
82
|
+
service_name: Human-readable service name for logging
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
bool: True if the service is available and has valid capabilities
|
|
86
|
+
"""
|
|
87
|
+
try:
|
|
88
|
+
with httpx.Client(**get_httpx_client_kwargs()) as http_client:
|
|
89
|
+
base_url = os.getenv("UIPATH_URL", "")
|
|
90
|
+
capabilities_url = f"{base_url.rstrip('/')}/{endpoint.value}"
|
|
91
|
+
loggger.debug(
|
|
92
|
+
f"Checking {service_name} capabilities at {capabilities_url}"
|
|
93
|
+
)
|
|
94
|
+
response = http_client.get(capabilities_url)
|
|
95
|
+
|
|
96
|
+
if response.status_code != 200:
|
|
97
|
+
return False
|
|
98
|
+
|
|
99
|
+
capabilities = response.json()
|
|
100
|
+
|
|
101
|
+
# Validate structure and required fields
|
|
102
|
+
if not isinstance(capabilities, dict) or "version" not in capabilities:
|
|
103
|
+
return False
|
|
104
|
+
|
|
105
|
+
return True
|
|
106
|
+
|
|
107
|
+
except Exception as e:
|
|
108
|
+
loggger.error(
|
|
109
|
+
f"Error checking {service_name} capabilities: {e}", exc_info=True
|
|
110
|
+
)
|
|
111
|
+
return False
|
|
112
|
+
|
|
113
|
+
@classmethod
|
|
114
|
+
def _check_agenthub(cls) -> bool:
|
|
115
|
+
"""Perform the actual check for AgentHub capabilities."""
|
|
116
|
+
return cls._check_capabilities(
|
|
117
|
+
UiPathEndpoints.AH_CAPABILITIES_ENDPOINT, "AgentHub"
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
@classmethod
|
|
121
|
+
def _check_orchestrator(cls) -> bool:
|
|
122
|
+
"""Perform the actual check for Orchestrator capabilities."""
|
|
123
|
+
return cls._check_capabilities(
|
|
124
|
+
UiPathEndpoints.OR_CAPABILITIES_ENDPOINT, "Orchestrator"
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
@classmethod
|
|
128
|
+
def _select_endpoint(cls, ah: UiPathEndpoints, orc: UiPathEndpoints) -> str:
|
|
129
|
+
"""Select an endpoint based on UIPATH_LLM_SERVICE override or capability checks."""
|
|
130
|
+
service_override = os.getenv("UIPATH_LLM_SERVICE", "").lower()
|
|
131
|
+
|
|
132
|
+
if service_override in ("agenthub", "ah"):
|
|
133
|
+
return ah.value
|
|
134
|
+
if service_override in ("orchestrator", "or"):
|
|
135
|
+
return orc.value
|
|
136
|
+
|
|
137
|
+
# Determine fallback order based on environment hints
|
|
138
|
+
hdens_env = os.getenv("HDENS_ENV", "").lower()
|
|
139
|
+
|
|
140
|
+
# Default order: AgentHub -> Orchestrator
|
|
141
|
+
check_order = [
|
|
142
|
+
("ah", ah, cls.is_agenthub_available),
|
|
143
|
+
("orc", orc, cls.is_orchestrator_available),
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
# Prioritize Orchestrator if HDENS_ENV is 'sf'
|
|
147
|
+
# Note: The default order already prioritizes AgentHub
|
|
148
|
+
if hdens_env == "sf":
|
|
149
|
+
check_order.reverse()
|
|
150
|
+
|
|
151
|
+
# Execute fallback checks in the determined order
|
|
152
|
+
for _, endpoint, is_available in check_order:
|
|
153
|
+
if is_available():
|
|
154
|
+
return endpoint.value
|
|
155
|
+
|
|
156
|
+
url = os.getenv("UIPATH_URL", "")
|
|
157
|
+
if ".uipath.com" in url:
|
|
158
|
+
return ah.value
|
|
159
|
+
else:
|
|
160
|
+
return orc.value
|
|
161
|
+
|
|
162
|
+
@classmethod
|
|
163
|
+
def get_passthrough_endpoint(cls) -> str:
|
|
164
|
+
"""Get the passthrough completion endpoint."""
|
|
165
|
+
return cls._select_endpoint(
|
|
166
|
+
UiPathEndpoints.AH_PASSTHROUGH_COMPLETION_ENDPOINT,
|
|
167
|
+
UiPathEndpoints.OR_PASSTHROUGH_COMPLETION_ENDPOINT,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
@classmethod
|
|
171
|
+
def get_normalized_endpoint(cls) -> str:
|
|
172
|
+
"""Get the normalized completion endpoint."""
|
|
173
|
+
return cls._select_endpoint(
|
|
174
|
+
UiPathEndpoints.AH_NORMALIZED_COMPLETION_ENDPOINT,
|
|
175
|
+
UiPathEndpoints.OR_NORMALIZED_COMPLETION_ENDPOINT,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
@classmethod
|
|
179
|
+
def get_embeddings_endpoint(cls) -> str:
|
|
180
|
+
"""Get the embeddings endpoint."""
|
|
181
|
+
return cls._select_endpoint(
|
|
182
|
+
UiPathEndpoints.AH_EMBEDDING_ENDPOINT,
|
|
183
|
+
UiPathEndpoints.OR_EMBEDDING_ENDPOINT,
|
|
184
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uipath
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.133
|
|
4
4
|
Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
|
|
5
5
|
Project-URL: Homepage, https://uipath.com
|
|
6
6
|
Project-URL: Repository, https://github.com/UiPath/uipath-python
|
|
@@ -233,10 +233,10 @@ uipath/tracing/_otel_exporters.py,sha256=68wuAZyB_PScnSCW230PVs3qSqoJBNoArJJaE4U
|
|
|
233
233
|
uipath/tracing/_traced.py,sha256=VAwEIfDHLx-AZ792SeGxCtOttEJXrLgI0YCkUMbxHsQ,20344
|
|
234
234
|
uipath/tracing/_utils.py,sha256=emsQRgYu-P1gj1q7XUPJD94mOa12JvhheRkuZJpLd9Y,15051
|
|
235
235
|
uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
|
|
236
|
-
uipath/utils/_endpoints_manager.py,sha256=
|
|
236
|
+
uipath/utils/_endpoints_manager.py,sha256=4JsKLpSNJSqQcotIc_RWS691ywQeCVNwOyY-7ujX2u0,7365
|
|
237
237
|
uipath/utils/dynamic_schema.py,sha256=ahgRLBWzuU0SQilaQVBJfBAVjimq3N3QJ1ztx0U_h2c,4943
|
|
238
|
-
uipath-2.1.
|
|
239
|
-
uipath-2.1.
|
|
240
|
-
uipath-2.1.
|
|
241
|
-
uipath-2.1.
|
|
242
|
-
uipath-2.1.
|
|
238
|
+
uipath-2.1.133.dist-info/METADATA,sha256=oOof3axmNHmlENEKcbtYPKn33tl99I-_dvh5UkYMA74,6626
|
|
239
|
+
uipath-2.1.133.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
240
|
+
uipath-2.1.133.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
|
|
241
|
+
uipath-2.1.133.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
|
242
|
+
uipath-2.1.133.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|