uipath 2.1.18__py3-none-any.whl → 2.1.20__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/_cli/_runtime/_runtime.py +43 -7
- uipath/_cli/_utils/_input_args.py +28 -1
- uipath/_cli/_utils/_parse_ast.py +12 -0
- uipath/_cli/_utils/_project_files.py +7 -0
- uipath/_services/connections_service.py +82 -2
- uipath/_utils/_infer_bindings.py +5 -2
- uipath/models/__init__.py +2 -1
- uipath/models/connections.py +17 -0
- uipath/utils/_endpoints_manager.py +123 -24
- {uipath-2.1.18.dist-info → uipath-2.1.20.dist-info}/METADATA +1 -1
- {uipath-2.1.18.dist-info → uipath-2.1.20.dist-info}/RECORD +14 -14
- {uipath-2.1.18.dist-info → uipath-2.1.20.dist-info}/WHEEL +0 -0
- {uipath-2.1.18.dist-info → uipath-2.1.20.dist-info}/entry_points.txt +0 -0
- {uipath-2.1.18.dist-info → uipath-2.1.20.dist-info}/licenses/LICENSE +0 -0
uipath/_cli/_runtime/_runtime.py
CHANGED
@@ -11,6 +11,7 @@ from typing import Any, Dict, Optional, Type, TypeVar, cast, get_type_hints
|
|
11
11
|
from opentelemetry import trace
|
12
12
|
from opentelemetry.sdk.trace import TracerProvider
|
13
13
|
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
14
|
+
from pydantic import BaseModel
|
14
15
|
|
15
16
|
from uipath.tracing import LlmOpsHttpExporter
|
16
17
|
|
@@ -162,9 +163,11 @@ class UiPathRuntime(UiPathBaseRuntime):
|
|
162
163
|
input_param = params[0]
|
163
164
|
input_type = input_param.annotation
|
164
165
|
|
165
|
-
# Case 2: Class or
|
166
|
+
# Case 2: Class, dataclass, or Pydantic model parameter
|
166
167
|
if input_type != inspect.Parameter.empty and (
|
167
|
-
is_dataclass(input_type)
|
168
|
+
is_dataclass(input_type)
|
169
|
+
or self._is_pydantic_model(input_type)
|
170
|
+
or hasattr(input_type, "__annotations__")
|
168
171
|
):
|
169
172
|
try:
|
170
173
|
valid_type = cast(Type[Any], input_type)
|
@@ -216,7 +219,16 @@ class UiPathRuntime(UiPathBaseRuntime):
|
|
216
219
|
)
|
217
220
|
|
218
221
|
def _convert_to_class(self, data: Dict[str, Any], cls: Type[T]) -> T:
|
219
|
-
"""Convert a dictionary to either a dataclass or regular class instance."""
|
222
|
+
"""Convert a dictionary to either a dataclass, Pydantic model, or regular class instance."""
|
223
|
+
# Handle Pydantic models
|
224
|
+
try:
|
225
|
+
if inspect.isclass(cls) and issubclass(cls, BaseModel):
|
226
|
+
return cast(T, cls.model_validate(data))
|
227
|
+
except TypeError:
|
228
|
+
# issubclass can raise TypeError if cls is not a class
|
229
|
+
pass
|
230
|
+
|
231
|
+
# Handle dataclasses
|
220
232
|
if is_dataclass(cls):
|
221
233
|
field_types = get_type_hints(cls)
|
222
234
|
converted_data = {}
|
@@ -227,13 +239,17 @@ class UiPathRuntime(UiPathBaseRuntime):
|
|
227
239
|
|
228
240
|
value = data[field_name]
|
229
241
|
if (
|
230
|
-
is_dataclass(field_type)
|
242
|
+
is_dataclass(field_type)
|
243
|
+
or self._is_pydantic_model(field_type)
|
244
|
+
or hasattr(field_type, "__annotations__")
|
231
245
|
) and isinstance(value, dict):
|
232
246
|
typed_field = cast(Type[Any], field_type)
|
233
247
|
value = self._convert_to_class(value, typed_field)
|
234
248
|
converted_data[field_name] = value
|
235
249
|
|
236
250
|
return cast(T, cls(**converted_data))
|
251
|
+
|
252
|
+
# Handle regular classes
|
237
253
|
else:
|
238
254
|
sig = inspect.signature(cls.__init__)
|
239
255
|
params = sig.parameters
|
@@ -254,6 +270,7 @@ class UiPathRuntime(UiPathBaseRuntime):
|
|
254
270
|
|
255
271
|
if (
|
256
272
|
is_dataclass(param_type)
|
273
|
+
or self._is_pydantic_model(param_type)
|
257
274
|
or hasattr(param_type, "__annotations__")
|
258
275
|
) and isinstance(value, dict):
|
259
276
|
typed_param = cast(Type[Any], param_type)
|
@@ -265,22 +282,41 @@ class UiPathRuntime(UiPathBaseRuntime):
|
|
265
282
|
|
266
283
|
return cls(**init_args)
|
267
284
|
|
285
|
+
def _is_pydantic_model(self, cls: Type[Any]) -> bool:
|
286
|
+
"""Safely check if a class is a Pydantic model."""
|
287
|
+
try:
|
288
|
+
return inspect.isclass(cls) and issubclass(cls, BaseModel)
|
289
|
+
except TypeError:
|
290
|
+
# issubclass can raise TypeError if cls is not a class
|
291
|
+
return False
|
292
|
+
|
268
293
|
def _convert_from_class(self, obj: Any) -> Dict[str, Any]:
|
269
|
-
"""Convert a class instance (dataclass or regular) to a dictionary."""
|
294
|
+
"""Convert a class instance (dataclass, Pydantic model, or regular) to a dictionary."""
|
270
295
|
if obj is None:
|
271
296
|
return {}
|
272
297
|
|
273
|
-
|
298
|
+
# Handle Pydantic models
|
299
|
+
if isinstance(obj, BaseModel):
|
300
|
+
return obj.model_dump()
|
301
|
+
|
302
|
+
# Handle dataclasses
|
303
|
+
elif is_dataclass(obj):
|
274
304
|
# Make sure obj is an instance, not a class
|
275
305
|
if isinstance(obj, type):
|
276
306
|
return {}
|
277
307
|
return asdict(obj)
|
308
|
+
|
309
|
+
# Handle regular classes
|
278
310
|
elif hasattr(obj, "__dict__"):
|
279
311
|
result = {}
|
280
312
|
for key, value in obj.__dict__.items():
|
281
313
|
# Skip private attributes
|
282
314
|
if not key.startswith("_"):
|
283
|
-
if
|
315
|
+
if (
|
316
|
+
isinstance(value, BaseModel)
|
317
|
+
or hasattr(value, "__dict__")
|
318
|
+
or is_dataclass(value)
|
319
|
+
):
|
284
320
|
result[key] = self._convert_from_class(value)
|
285
321
|
else:
|
286
322
|
result[key] = value
|
@@ -14,6 +14,8 @@ from typing import (
|
|
14
14
|
get_type_hints,
|
15
15
|
)
|
16
16
|
|
17
|
+
from pydantic import BaseModel
|
18
|
+
|
17
19
|
SchemaType = Literal["object", "integer", "double", "string", "boolean", "array"]
|
18
20
|
|
19
21
|
TYPE_MAP: Dict[str, SchemaType] = {
|
@@ -50,7 +52,30 @@ def get_type_schema(type_hint: Any) -> Dict[str, Any]:
|
|
50
52
|
return {"type": "object"}
|
51
53
|
|
52
54
|
if inspect.isclass(type_hint):
|
53
|
-
|
55
|
+
# Handle Pydantic models
|
56
|
+
if issubclass(type_hint, BaseModel):
|
57
|
+
properties = {}
|
58
|
+
required = []
|
59
|
+
|
60
|
+
# Get the model fields
|
61
|
+
model_fields = type_hint.model_fields
|
62
|
+
|
63
|
+
for field_name, field_info in model_fields.items():
|
64
|
+
# Use alias if defined, otherwise use field name
|
65
|
+
schema_field_name = field_info.alias if field_info.alias else field_name
|
66
|
+
|
67
|
+
# Get the field type schema
|
68
|
+
field_schema = get_type_schema(field_info.annotation)
|
69
|
+
properties[schema_field_name] = field_schema
|
70
|
+
|
71
|
+
# Check if field is required using Pydantic's built-in method
|
72
|
+
if field_info.is_required():
|
73
|
+
required.append(schema_field_name)
|
74
|
+
|
75
|
+
return {"type": "object", "properties": properties, "required": required}
|
76
|
+
|
77
|
+
# Handle dataclasses
|
78
|
+
elif is_dataclass(type_hint):
|
54
79
|
properties = {}
|
55
80
|
required = []
|
56
81
|
|
@@ -61,6 +86,8 @@ def get_type_schema(type_hint: Any) -> Dict[str, Any]:
|
|
61
86
|
required.append(field.name)
|
62
87
|
|
63
88
|
return {"type": "object", "properties": properties, "required": required}
|
89
|
+
|
90
|
+
# Handle regular classes with annotations
|
64
91
|
elif hasattr(type_hint, "__annotations__"):
|
65
92
|
properties = {}
|
66
93
|
required = []
|
uipath/_cli/_utils/_parse_ast.py
CHANGED
@@ -8,6 +8,7 @@ from typing import Any, Dict, List, Optional, Tuple
|
|
8
8
|
from ..._services import (
|
9
9
|
AssetsService,
|
10
10
|
BucketsService,
|
11
|
+
ConnectionsService,
|
11
12
|
ContextGroundingService,
|
12
13
|
ProcessesService,
|
13
14
|
)
|
@@ -47,6 +48,7 @@ supported_bindings_by_service = {
|
|
47
48
|
"processes": ProcessesService,
|
48
49
|
"buckets": BucketsService,
|
49
50
|
"context_grounding": ContextGroundingService,
|
51
|
+
"connections": ConnectionsService,
|
50
52
|
}
|
51
53
|
|
52
54
|
|
@@ -103,7 +105,17 @@ class ServiceUsage:
|
|
103
105
|
|
104
106
|
# custom logic for connections bindings
|
105
107
|
elif self.service_name == "connections":
|
108
|
+
# First, try to get inferred bindings for connections if they exist
|
109
|
+
connections_service = supported_bindings_by_service.get("connections")
|
110
|
+
inferred_bindings = {}
|
111
|
+
if connections_service:
|
112
|
+
inferred_bindings = get_inferred_bindings_names(connections_service)
|
113
|
+
|
106
114
|
for call in self.method_calls:
|
115
|
+
# Skip methods that are decorated with @infer_bindings(ignore=False)
|
116
|
+
if call.method_name in inferred_bindings:
|
117
|
+
continue
|
118
|
+
|
107
119
|
if len(call.args) > 0:
|
108
120
|
connection_id = call.args[0]
|
109
121
|
if connection_id:
|
@@ -68,6 +68,7 @@ def get_project_config(directory: str) -> dict[str, str]:
|
|
68
68
|
"version": toml_data["version"],
|
69
69
|
"authors": toml_data["authors"],
|
70
70
|
"dependencies": toml_data.get("dependencies", {}),
|
71
|
+
"requires-python": toml_data.get("requires-python", {}),
|
71
72
|
}
|
72
73
|
|
73
74
|
|
@@ -97,6 +98,11 @@ def validate_config(config: dict[str, str]) -> None:
|
|
97
98
|
'Project authors cannot be empty. Please specify authors in pyproject.toml:\n authors = [{ name = "John Doe" }]'
|
98
99
|
)
|
99
100
|
|
101
|
+
if not config["requires-python"] or config["requires-python"].strip() == "":
|
102
|
+
console.error(
|
103
|
+
"'requires-python' field cannot be empty. Please specify it in pyproject.toml: requires-python = \">=3.10\""
|
104
|
+
)
|
105
|
+
|
100
106
|
invalid_chars = ["&", "<", ">", '"', "'", ";"]
|
101
107
|
for char in invalid_chars:
|
102
108
|
if char in config["project_name"]:
|
@@ -296,6 +302,7 @@ def read_toml_project(file_path: str) -> dict:
|
|
296
302
|
"version": project["version"].strip(),
|
297
303
|
"authors": author_name.strip(),
|
298
304
|
"dependencies": dependencies,
|
305
|
+
"requires-python": project.get("requires-python", "").strip(),
|
299
306
|
}
|
300
307
|
|
301
308
|
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import json
|
1
2
|
import logging
|
3
|
+
from typing import Any, Dict
|
2
4
|
|
3
5
|
from .._config import Config
|
4
6
|
from .._execution_context import ExecutionContext
|
5
|
-
from .._utils import Endpoint, RequestSpec
|
6
|
-
from ..models import Connection, ConnectionToken
|
7
|
+
from .._utils import Endpoint, RequestSpec, infer_bindings
|
8
|
+
from ..models import Connection, ConnectionToken, EventArguments
|
7
9
|
from ..tracing._traced import traced
|
8
10
|
from ._base_service import BaseService
|
9
11
|
|
@@ -112,6 +114,84 @@ class ConnectionsService(BaseService):
|
|
112
114
|
)
|
113
115
|
return ConnectionToken.model_validate(response.json())
|
114
116
|
|
117
|
+
@traced(
|
118
|
+
name="connections_retrieve_event_payload",
|
119
|
+
run_type="uipath",
|
120
|
+
)
|
121
|
+
@infer_bindings(resource_type="ignored", ignore=True)
|
122
|
+
def retrieve_event_payload(self, event_args: EventArguments) -> Dict[str, Any]:
|
123
|
+
"""Retrieve event payload from UiPath Integration Service.
|
124
|
+
|
125
|
+
Args:
|
126
|
+
event_args (EventArguments): The event arguments. Should be passed along from the job's input.
|
127
|
+
|
128
|
+
Returns:
|
129
|
+
Dict[str, Any]: The event payload data
|
130
|
+
"""
|
131
|
+
if not event_args.additional_event_data:
|
132
|
+
raise ValueError("additional_event_data is required")
|
133
|
+
|
134
|
+
# Parse additional event data to get event id
|
135
|
+
event_data = json.loads(event_args.additional_event_data)
|
136
|
+
|
137
|
+
event_id = None
|
138
|
+
if "processedEventId" in event_data:
|
139
|
+
event_id = event_data["processedEventId"]
|
140
|
+
elif "rawEventId" in event_data:
|
141
|
+
event_id = event_data["rawEventId"]
|
142
|
+
else:
|
143
|
+
raise ValueError("Event Id not found in additional event data")
|
144
|
+
|
145
|
+
# Build request URL using connection token's API base URI
|
146
|
+
spec = self._retrieve_event_payload_spec("v1", event_id)
|
147
|
+
|
148
|
+
response = self.request(spec.method, url=spec.endpoint)
|
149
|
+
|
150
|
+
return response.json()
|
151
|
+
|
152
|
+
@traced(
|
153
|
+
name="connections_retrieve_event_payload",
|
154
|
+
run_type="uipath",
|
155
|
+
)
|
156
|
+
@infer_bindings(resource_type="ignored", ignore=True)
|
157
|
+
async def retrieve_event_payload_async(
|
158
|
+
self, event_args: EventArguments
|
159
|
+
) -> Dict[str, Any]:
|
160
|
+
"""Retrieve event payload from UiPath Integration Service.
|
161
|
+
|
162
|
+
Args:
|
163
|
+
event_args (EventArguments): The event arguments. Should be passed along from the job's input.
|
164
|
+
|
165
|
+
Returns:
|
166
|
+
Dict[str, Any]: The event payload data
|
167
|
+
"""
|
168
|
+
if not event_args.additional_event_data:
|
169
|
+
raise ValueError("additional_event_data is required")
|
170
|
+
|
171
|
+
# Parse additional event data to get event id
|
172
|
+
event_data = json.loads(event_args.additional_event_data)
|
173
|
+
|
174
|
+
event_id = None
|
175
|
+
if "processedEventId" in event_data:
|
176
|
+
event_id = event_data["processedEventId"]
|
177
|
+
elif "rawEventId" in event_data:
|
178
|
+
event_id = event_data["rawEventId"]
|
179
|
+
else:
|
180
|
+
raise ValueError("Event Id not found in additional event data")
|
181
|
+
|
182
|
+
# Build request URL using connection token's API base URI
|
183
|
+
spec = self._retrieve_event_payload_spec("v1", event_id)
|
184
|
+
|
185
|
+
response = await self.request_async(spec.method, url=spec.endpoint)
|
186
|
+
|
187
|
+
return response.json()
|
188
|
+
|
189
|
+
def _retrieve_event_payload_spec(self, version: str, event_id: str) -> RequestSpec:
|
190
|
+
return RequestSpec(
|
191
|
+
method="GET",
|
192
|
+
endpoint=Endpoint(f"/elements_/{version}/events/{event_id}"),
|
193
|
+
)
|
194
|
+
|
115
195
|
def _retrieve_spec(self, key: str) -> RequestSpec:
|
116
196
|
return RequestSpec(
|
117
197
|
method="GET",
|
uipath/_utils/_infer_bindings.py
CHANGED
@@ -8,7 +8,10 @@ T = TypeVar("T")
|
|
8
8
|
|
9
9
|
|
10
10
|
def infer_bindings(
|
11
|
-
resource_type: str,
|
11
|
+
resource_type: str,
|
12
|
+
name: str = "name",
|
13
|
+
folder_path: str = "folder_path",
|
14
|
+
ignore: bool = False,
|
12
15
|
) -> Callable[..., Any]:
|
13
16
|
def decorator(func: Callable[..., Any]):
|
14
17
|
@functools.wraps(func)
|
@@ -30,7 +33,7 @@ def infer_bindings(
|
|
30
33
|
|
31
34
|
return func(**all_args)
|
32
35
|
|
33
|
-
wrapper._should_infer_bindings =
|
36
|
+
wrapper._should_infer_bindings = not ignore # type: ignore
|
34
37
|
wrapper._infer_bindings_mappings = {"name": name, "folder_path": folder_path} # type: ignore
|
35
38
|
return wrapper
|
36
39
|
|
uipath/models/__init__.py
CHANGED
@@ -3,7 +3,7 @@ from .actions import Action
|
|
3
3
|
from .assets import Asset, UserAsset
|
4
4
|
from .attachment import Attachment
|
5
5
|
from .buckets import Bucket
|
6
|
-
from .connections import Connection, ConnectionToken
|
6
|
+
from .connections import Connection, ConnectionToken, EventArguments
|
7
7
|
from .context_grounding import ContextGroundingQueryResponse
|
8
8
|
from .context_grounding_index import ContextGroundingIndex
|
9
9
|
from .errors import BaseUrlMissingError, SecretMissingError
|
@@ -39,6 +39,7 @@ __all__ = [
|
|
39
39
|
"TransactionItemResult",
|
40
40
|
"Connection",
|
41
41
|
"ConnectionToken",
|
42
|
+
"EventArguments",
|
42
43
|
"Job",
|
43
44
|
"InvokeProcess",
|
44
45
|
"ActionSchema",
|
uipath/models/connections.py
CHANGED
@@ -49,3 +49,20 @@ class ConnectionToken(BaseModel):
|
|
49
49
|
expires_in: Optional[int] = Field(default=None, alias="expiresIn")
|
50
50
|
api_base_uri: Optional[str] = Field(default=None, alias="apiBaseUri")
|
51
51
|
element_instance_id: Optional[int] = Field(default=None, alias="elementInstanceId")
|
52
|
+
|
53
|
+
|
54
|
+
class EventArguments(BaseModel):
|
55
|
+
event_connector: Optional[str] = Field(default=None, alias="UiPathEventConnector")
|
56
|
+
event: Optional[str] = Field(default=None, alias="UiPathEvent")
|
57
|
+
event_object_type: Optional[str] = Field(
|
58
|
+
default=None, alias="UiPathEventObjectType"
|
59
|
+
)
|
60
|
+
event_object_id: Optional[str] = Field(default=None, alias="UiPathEventObjectId")
|
61
|
+
additional_event_data: Optional[str] = Field(
|
62
|
+
default=None, alias="UiPathAdditionalEventData"
|
63
|
+
)
|
64
|
+
|
65
|
+
model_config = ConfigDict(
|
66
|
+
populate_by_name=True,
|
67
|
+
extra="allow",
|
68
|
+
)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import logging
|
2
2
|
import os
|
3
|
+
import re
|
3
4
|
from enum import Enum
|
4
5
|
from typing import Optional
|
5
6
|
|
@@ -18,9 +19,14 @@ class UiPathEndpoints(Enum):
|
|
18
19
|
)
|
19
20
|
AH_CAPABILITIES_ENDPOINT = "agenthub_/llm/api/capabilities"
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
OR_NORMALIZED_COMPLETION_ENDPOINT = "orchestrator_/llm/api/chat/completions"
|
23
|
+
OR_PASSTHROUGH_COMPLETION_ENDPOINT = "orchestrator_/llm/openai/deployments/{model}/chat/completions?api-version={api_version}"
|
24
|
+
OR_EMBEDDING_ENDPOINT = "orchestrator_/llm/openai/deployments/{model}/embeddings?api-version={api_version}"
|
25
|
+
OR_CAPABILITIES_ENDPOINT = "orchestrator_/llm/api/capabilities"
|
26
|
+
|
27
|
+
LG_NORMALIZED_COMPLETION_ENDPOINT = "llmgateway_/api/chat/completions"
|
28
|
+
LG_PASSTHROUGH_COMPLETION_ENDPOINT = "llmgateway_/openai/deployments/{model}/chat/completions?api-version={api_version}"
|
29
|
+
LG_EMBEDDING_ENDPOINT = (
|
24
30
|
"llmgateway_/openai/deployments/{model}/embeddings?api-version={api_version}"
|
25
31
|
)
|
26
32
|
|
@@ -28,24 +34,39 @@ class UiPathEndpoints(Enum):
|
|
28
34
|
class EndpointManager:
|
29
35
|
"""Manages and caches the UiPath endpoints.
|
30
36
|
This class provides functionality to determine which UiPath endpoints to use based on
|
31
|
-
the availability of AgentHub. It checks for
|
32
|
-
to avoid repeated network calls.
|
37
|
+
the availability of AgentHub and Orchestrator. It checks for capabilities and caches
|
38
|
+
the results to avoid repeated network calls.
|
39
|
+
|
40
|
+
The endpoint selection follows a fallback order:
|
41
|
+
1. AgentHub (if available)
|
42
|
+
2. Orchestrator (if available)
|
43
|
+
3. LLMGateway (default fallback)
|
44
|
+
|
45
|
+
Environment Variable Override:
|
46
|
+
The fallback behavior can be bypassed using the UIPATH_LLM_SERVICE environment variable:
|
47
|
+
- 'agenthub' or 'ah': Force use of AgentHub endpoints (skips capability checks)
|
48
|
+
- 'orchestrator' or 'or': Force use of Orchestrator endpoints (skips capability checks)
|
49
|
+
- 'llmgateway' or 'gateway': Force use of LLMGateway endpoints (skips capability checks)
|
50
|
+
|
33
51
|
Class Attributes:
|
34
52
|
_base_url (str): The base URL for UiPath services, retrieved from the UIPATH_URL
|
35
53
|
environment variable.
|
36
54
|
_agenthub_available (Optional[bool]): Cached result of AgentHub availability check.
|
55
|
+
_orchestrator_available (Optional[bool]): Cached result of Orchestrator availability check.
|
37
56
|
|
38
57
|
Methods:
|
39
58
|
is_agenthub_available(): Checks if AgentHub is available, caching the result.
|
59
|
+
is_orchestrator_available(): Checks if Orchestrator is available, caching the result.
|
40
60
|
get_passthrough_endpoint(): Returns the appropriate passthrough completion endpoint.
|
41
61
|
get_normalized_endpoint(): Returns the appropriate normalized completion endpoint.
|
42
62
|
get_embeddings_endpoint(): Returns the appropriate embeddings endpoint.
|
43
|
-
All endpoint methods automatically select
|
44
|
-
|
63
|
+
All endpoint methods automatically select the best available endpoint using the fallback order,
|
64
|
+
unless overridden by the UIPATH_LLM_SERVICE environment variable.
|
45
65
|
""" # noqa: D205
|
46
66
|
|
47
67
|
_base_url = os.getenv("UIPATH_URL", "")
|
48
68
|
_agenthub_available: Optional[bool] = None
|
69
|
+
_orchestrator_available: Optional[bool] = None
|
49
70
|
|
50
71
|
@classmethod
|
51
72
|
def is_agenthub_available(cls) -> bool:
|
@@ -55,13 +76,30 @@ class EndpointManager:
|
|
55
76
|
return cls._agenthub_available
|
56
77
|
|
57
78
|
@classmethod
|
58
|
-
def
|
59
|
-
"""
|
79
|
+
def is_orchestrator_available(cls) -> bool:
|
80
|
+
"""Check if Orchestrator is available and cache the result."""
|
81
|
+
if cls._orchestrator_available is None:
|
82
|
+
cls._orchestrator_available = cls._check_orchestrator()
|
83
|
+
return cls._orchestrator_available
|
84
|
+
|
85
|
+
@classmethod
|
86
|
+
def _check_capabilities(cls, endpoint: UiPathEndpoints, service_name: str) -> bool:
|
87
|
+
"""Perform the actual check for service capabilities.
|
88
|
+
|
89
|
+
Args:
|
90
|
+
endpoint: The capabilities endpoint to check
|
91
|
+
service_name: Human-readable service name for logging
|
92
|
+
|
93
|
+
Returns:
|
94
|
+
bool: True if the service is available and has valid capabilities
|
95
|
+
"""
|
60
96
|
try:
|
61
97
|
with httpx.Client(**get_httpx_client_kwargs()) as http_client:
|
62
98
|
base_url = os.getenv("UIPATH_URL", "")
|
63
|
-
capabilities_url = f"{base_url.rstrip('/')}/{
|
64
|
-
loggger.debug(
|
99
|
+
capabilities_url = f"{base_url.rstrip('/')}/{endpoint.value}"
|
100
|
+
loggger.debug(
|
101
|
+
f"Checking {service_name} capabilities at {capabilities_url}"
|
102
|
+
)
|
65
103
|
response = http_client.get(capabilities_url)
|
66
104
|
|
67
105
|
if response.status_code != 200:
|
@@ -76,26 +114,87 @@ class EndpointManager:
|
|
76
114
|
return True
|
77
115
|
|
78
116
|
except Exception as e:
|
79
|
-
loggger.error(
|
117
|
+
loggger.error(
|
118
|
+
f"Error checking {service_name} capabilities: {e}", exc_info=True
|
119
|
+
)
|
80
120
|
return False
|
81
121
|
|
82
122
|
@classmethod
|
83
|
-
def
|
84
|
-
|
85
|
-
|
123
|
+
def _check_agenthub(cls) -> bool:
|
124
|
+
"""Perform the actual check for AgentHub capabilities."""
|
125
|
+
return cls._check_capabilities(
|
126
|
+
UiPathEndpoints.AH_CAPABILITIES_ENDPOINT, "AgentHub"
|
127
|
+
)
|
86
128
|
|
87
|
-
|
129
|
+
@classmethod
|
130
|
+
def _check_orchestrator(cls) -> bool:
|
131
|
+
"""Perform the actual check for Orchestrator capabilities."""
|
132
|
+
return cls._check_capabilities(
|
133
|
+
UiPathEndpoints.OR_CAPABILITIES_ENDPOINT, "Orchestrator"
|
134
|
+
)
|
88
135
|
|
89
136
|
@classmethod
|
90
|
-
def
|
91
|
-
|
92
|
-
|
137
|
+
def _select_endpoint(
|
138
|
+
cls, ah: UiPathEndpoints, orc: UiPathEndpoints, gw: UiPathEndpoints
|
139
|
+
) -> str:
|
140
|
+
"""Select an endpoint based on UIPATH_LLM_SERVICE override or capability checks."""
|
141
|
+
service_override = os.getenv("UIPATH_LLM_SERVICE", "").lower()
|
142
|
+
|
143
|
+
if service_override in ("agenthub", "ah"):
|
144
|
+
return ah.value
|
145
|
+
if service_override in ("orchestrator", "or"):
|
146
|
+
return orc.value
|
147
|
+
if service_override in ("llmgateway", "gateway"):
|
148
|
+
return gw.value
|
149
|
+
|
150
|
+
# Determine fallback order based on environment hints
|
151
|
+
uipath_url = os.getenv("UIPATH_URL", "")
|
152
|
+
hdens_env = os.getenv("HDENS_ENV", "").lower()
|
153
|
+
|
154
|
+
is_cloud_url = re.match(r"https?://[^/]+\.uipath\.com", uipath_url)
|
155
|
+
|
156
|
+
# Default order: AgentHub -> Orchestrator
|
157
|
+
check_order = [
|
158
|
+
("ah", ah, cls.is_agenthub_available),
|
159
|
+
("orc", orc, cls.is_orchestrator_available),
|
160
|
+
]
|
161
|
+
|
162
|
+
# Prioritize Orchestrator if HDENS_ENV is 'sf' or url is cloud-based
|
163
|
+
# Note: The default order already prioritizes AgentHub
|
164
|
+
if hdens_env == "sf" or is_cloud_url:
|
165
|
+
check_order.reverse()
|
166
|
+
|
167
|
+
# Execute fallback checks in the determined order
|
168
|
+
for _, endpoint, is_available in check_order:
|
169
|
+
if is_available():
|
170
|
+
return endpoint.value
|
171
|
+
|
172
|
+
# Final fallback to LLMGateway
|
173
|
+
return gw.value
|
174
|
+
|
175
|
+
@classmethod
|
176
|
+
def get_passthrough_endpoint(cls) -> str:
|
177
|
+
"""Get the passthrough completion endpoint."""
|
178
|
+
return cls._select_endpoint(
|
179
|
+
UiPathEndpoints.AH_PASSTHROUGH_COMPLETION_ENDPOINT,
|
180
|
+
UiPathEndpoints.OR_PASSTHROUGH_COMPLETION_ENDPOINT,
|
181
|
+
UiPathEndpoints.LG_PASSTHROUGH_COMPLETION_ENDPOINT,
|
182
|
+
)
|
93
183
|
|
94
|
-
|
184
|
+
@classmethod
|
185
|
+
def get_normalized_endpoint(cls) -> str:
|
186
|
+
"""Get the normalized completion endpoint."""
|
187
|
+
return cls._select_endpoint(
|
188
|
+
UiPathEndpoints.AH_NORMALIZED_COMPLETION_ENDPOINT,
|
189
|
+
UiPathEndpoints.OR_NORMALIZED_COMPLETION_ENDPOINT,
|
190
|
+
UiPathEndpoints.LG_NORMALIZED_COMPLETION_ENDPOINT,
|
191
|
+
)
|
95
192
|
|
96
193
|
@classmethod
|
97
194
|
def get_embeddings_endpoint(cls) -> str:
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
195
|
+
"""Get the embeddings endpoint."""
|
196
|
+
return cls._select_endpoint(
|
197
|
+
UiPathEndpoints.AH_EMBEDDING_ENDPOINT,
|
198
|
+
UiPathEndpoints.OR_EMBEDDING_ENDPOINT,
|
199
|
+
UiPathEndpoints.LG_EMBEDDING_ENDPOINT,
|
200
|
+
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: uipath
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.20
|
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
|
@@ -47,7 +47,7 @@ uipath/_cli/_runtime/_contracts.py,sha256=WlpaiQAMWCo-JFHjee35Klf49A3GsKjOU1Mf2I
|
|
47
47
|
uipath/_cli/_runtime/_escalation.py,sha256=x3vI98qsfRA-fL_tNkRVTFXioM5Gv2w0GFcXJJ5eQtg,7981
|
48
48
|
uipath/_cli/_runtime/_hitl.py,sha256=aexwe0dIXvh6SlVS1jVnO_aGZc6e3gLsmGkCyha5AHo,11300
|
49
49
|
uipath/_cli/_runtime/_logging.py,sha256=0_8OeF2w2zcryvozOsB3h4sFktiwnUqJr_fMRxwUFOc,8004
|
50
|
-
uipath/_cli/_runtime/_runtime.py,sha256=
|
50
|
+
uipath/_cli/_runtime/_runtime.py,sha256=Lee055XQBFe5sUiwo5T7XKOxKRCsv8gvy9wSZBnqVak,11917
|
51
51
|
uipath/_cli/_templates/.psmdcp.template,sha256=C7pBJPt98ovEljcBvGtEUGoWjjQhu9jls1bpYjeLOKA,611
|
52
52
|
uipath/_cli/_templates/.rels.template,sha256=-fTcw7OA1AcymHr0LzBqbMAAtzZTRXLTNa_ljq087Jk,406
|
53
53
|
uipath/_cli/_templates/[Content_Types].xml.template,sha256=bYsKDz31PkIF9QksjgAY_bqm57YC8U_owsZeNZAiBxQ,584
|
@@ -58,10 +58,10 @@ uipath/_cli/_utils/_console.py,sha256=scvnrrFoFX6CE451K-PXKV7UN0DUkInbOtDZ5jAdPP
|
|
58
58
|
uipath/_cli/_utils/_constants.py,sha256=rS8lQ5Nzull8ytajK6lBsz398qiCp1REoAwlHtyBwF0,1415
|
59
59
|
uipath/_cli/_utils/_debug.py,sha256=zamzIR4VgbdKADAE4gbmjxDsbgF7wvdr7C5Dqp744Oc,1739
|
60
60
|
uipath/_cli/_utils/_folders.py,sha256=UVJcKPfPAVR5HF4AP6EXdlNVcfEF1v5pwGCpoAgBY34,1155
|
61
|
-
uipath/_cli/_utils/_input_args.py,sha256=
|
62
|
-
uipath/_cli/_utils/_parse_ast.py,sha256=
|
61
|
+
uipath/_cli/_utils/_input_args.py,sha256=3LGNqVpJItvof75VGm-ZNTUMUH9-c7-YgleM5b2YgRg,5088
|
62
|
+
uipath/_cli/_utils/_parse_ast.py,sha256=8Iohz58s6bYQ7rgWtOTjrEInLJ-ETikmOMZzZdIY2Co,20072
|
63
63
|
uipath/_cli/_utils/_processes.py,sha256=q7DfEKHISDWf3pngci5za_z0Pbnf_shWiYEcTOTCiyk,1855
|
64
|
-
uipath/_cli/_utils/_project_files.py,sha256
|
64
|
+
uipath/_cli/_utils/_project_files.py,sha256=MMexSE6BapxitYBl1UUWy_AgkJMdGNFD1t2MkU0hwz4,13115
|
65
65
|
uipath/_cli/_utils/_studio_project.py,sha256=iVcCm-aps-EQ7Pym_OWGOA48xeDigzcofUxXKy29x6U,13727
|
66
66
|
uipath/_cli/_utils/_tracing.py,sha256=2igb03j3EHjF_A406UhtCKkPfudVfFPjUq5tXUEG4oo,1541
|
67
67
|
uipath/_cli/_utils/_uv_helpers.py,sha256=6SvoLnZPoKIxW0sjMvD1-ENV_HOXDYzH34GjBqwT138,3450
|
@@ -72,7 +72,7 @@ uipath/_services/api_client.py,sha256=AbRmpXQScrJIVfDQM309G1GNP3ILLKOrusouhxNQZf
|
|
72
72
|
uipath/_services/assets_service.py,sha256=acqWogfhZiSO1eeVYqFxmqWGSTmrW46QxI1J0bJe3jo,11918
|
73
73
|
uipath/_services/attachments_service.py,sha256=NPQYK7CGjfBaNT_1S5vEAfODmOChTbQZforllFM2ofU,26678
|
74
74
|
uipath/_services/buckets_service.py,sha256=5s8tuivd7GUZYj774DDUYTa0axxlUuesc4EBY1V5sdk,18496
|
75
|
-
uipath/_services/connections_service.py,sha256=
|
75
|
+
uipath/_services/connections_service.py,sha256=Rf-DCm43tsDM6Cfp41iwGR4gUk_YCdobGcmbSoKvQ6E,7480
|
76
76
|
uipath/_services/context_grounding_service.py,sha256=EBf7lIIYz_s1ubf_07OAZXQHjS8kpZ2vqxo4mI3VL-A,25009
|
77
77
|
uipath/_services/folder_service.py,sha256=9JqgjKhWD-G_KUnfUTP2BADxL6OK9QNZsBsWZHAULdE,2749
|
78
78
|
uipath/_services/jobs_service.py,sha256=CnDd7BM4AMqcMIR1qqu5ohhxf9m0AF4dnGoF4EX38kw,30872
|
@@ -81,7 +81,7 @@ uipath/_services/processes_service.py,sha256=Pk6paw7e_a-WvVcfKDLuyj1p--pvNRTXwZN
|
|
81
81
|
uipath/_services/queues_service.py,sha256=VaG3dWL2QK6AJBOLoW2NQTpkPfZjsqsYPl9-kfXPFzA,13534
|
82
82
|
uipath/_utils/__init__.py,sha256=VdcpnENJIa0R6Y26NoxY64-wUVyvb4pKfTh1wXDQeMk,526
|
83
83
|
uipath/_utils/_endpoint.py,sha256=yYHwqbQuJIevpaTkdfYJS9CrtlFeEyfb5JQK5osTCog,2489
|
84
|
-
uipath/_utils/_infer_bindings.py,sha256=
|
84
|
+
uipath/_utils/_infer_bindings.py,sha256=yTl3JBgoLwtQV-RCUkDY4qZne9FtE3HHIiYgCAKAOKw,1727
|
85
85
|
uipath/_utils/_logs.py,sha256=adfX_0UAn3YBeKJ8DQDeZs94rJyHGQO00uDfkaTpNWQ,510
|
86
86
|
uipath/_utils/_read_overwrites.py,sha256=OQgG9ycPpFnLub5ELQdX9V2Fyh6F9_zDR3xoYagJaMI,5287
|
87
87
|
uipath/_utils/_request_override.py,sha256=fIVHzgHVXITUlWcp8osNBwIafM1qm4_ejx0ng5UzfJ4,573
|
@@ -90,13 +90,13 @@ uipath/_utils/_ssl_context.py,sha256=xSYitos0eJc9cPHzNtHISX9PBvL6D2vas5G_GiBdLp8
|
|
90
90
|
uipath/_utils/_url.py,sha256=-4eluSrIZCUlnQ3qU17WPJkgaC2KwF9W5NeqGnTNGGo,2512
|
91
91
|
uipath/_utils/_user_agent.py,sha256=pVJkFYacGwaQBomfwWVAvBQgdBUo62e4n3-fLIajWUU,563
|
92
92
|
uipath/_utils/constants.py,sha256=9sjOPn2y4mU2KzBwKpkDOd1QW6AgL7omJBoCk4XebKk,1038
|
93
|
-
uipath/models/__init__.py,sha256=
|
93
|
+
uipath/models/__init__.py,sha256=d_DkK1AtRUetM1t2NrH5UKgvJOBiynzaKnK5pMY7aIc,1289
|
94
94
|
uipath/models/action_schema.py,sha256=lKDhP7Eix23fFvfQrqqNmSOiPyyNF6tiRpUu0VZIn_M,714
|
95
95
|
uipath/models/actions.py,sha256=ekSH4YUQR4KPOH-heBm9yOgOfirndx0In4_S4VYWeEU,2993
|
96
96
|
uipath/models/assets.py,sha256=Q-7_xmm503XHTKgCDrDtXsFl3VWBSVSyiWYW0mZjsnA,2942
|
97
97
|
uipath/models/attachment.py,sha256=prBlhhTvaBnLXJ3PKKxxHWbus35dCuag3_5HngksUjU,843
|
98
98
|
uipath/models/buckets.py,sha256=N3Lj_dVCv709-ywhOOdyCSvsuLn41eGuAfSiik6Q6F8,1285
|
99
|
-
uipath/models/connections.py,sha256=
|
99
|
+
uipath/models/connections.py,sha256=Kej_t2mH-JOomf8pDXPWW1SrvOd8OraOjOH0nKBrVlU,2598
|
100
100
|
uipath/models/context_grounding.py,sha256=S9PeOlFlw7VxzzJVR_Fs28OObW3MLHUPCFqNgkEz24k,1315
|
101
101
|
uipath/models/context_grounding_index.py,sha256=0ADlH8fC10qIbakgwU89pRVawzJ36TiSDKIqOhUdhuA,2580
|
102
102
|
uipath/models/errors.py,sha256=gPyU4sKYn57v03aOVqm97mnU9Do2e7bwMQwiSQVp9qc,461
|
@@ -114,9 +114,9 @@ uipath/tracing/_otel_exporters.py,sha256=X7cnuGqvxGbACZuFD2XYTWXwIse8pokOEAjeTPE
|
|
114
114
|
uipath/tracing/_traced.py,sha256=qeVDrds2OUnpdUIA0RhtF0kg2dlAZhyC1RRkI-qivTM,18528
|
115
115
|
uipath/tracing/_utils.py,sha256=ZeensQexnw69jVcsVrGyED7mPlAU-L1agDGm6_1A3oc,10388
|
116
116
|
uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
|
117
|
-
uipath/utils/_endpoints_manager.py,sha256=
|
118
|
-
uipath-2.1.
|
119
|
-
uipath-2.1.
|
120
|
-
uipath-2.1.
|
121
|
-
uipath-2.1.
|
122
|
-
uipath-2.1.
|
117
|
+
uipath/utils/_endpoints_manager.py,sha256=iRTl5Q0XAm_YgcnMcJOXtj-8052sr6jpWuPNz6CgT0Q,8408
|
118
|
+
uipath-2.1.20.dist-info/METADATA,sha256=CMJ4e0Xkauc6EZhmTQW6kVrQ3mnhWjZte2atCM4JyyE,6367
|
119
|
+
uipath-2.1.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
120
|
+
uipath-2.1.20.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
|
121
|
+
uipath-2.1.20.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
122
|
+
uipath-2.1.20.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|