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.

@@ -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
- LG_NORMALIZED_COMPLETION_ENDPOINT = "llmgateway_/api/chat/completions"
27
- LG_PASSTHROUGH_COMPLETION_ENDPOINT = "llmgateway_/openai/deployments/{model}/chat/completions?api-version={api_version}"
28
- LG_EMBEDDING_ENDPOINT = (
29
- "llmgateway_/openai/deployments/{model}/embeddings?api-version={api_version}"
30
- )
31
-
32
-
33
- class EndpointManager:
34
- """Manages and caches the UiPath endpoints.
35
- This class provides functionality to determine which UiPath endpoints to use based on
36
- the availability of AgentHub and Orchestrator. It checks for capabilities and caches
37
- the results to avoid repeated network calls.
38
-
39
- The endpoint selection follows a fallback order:
40
- 1. AgentHub (if available)
41
- 2. Orchestrator (if available)
42
- 3. LLMGateway (default fallback)
43
-
44
- Environment Variable Override:
45
- The fallback behavior can be bypassed using the UIPATH_LLM_SERVICE environment variable:
46
- - 'agenthub' or 'ah': Force use of AgentHub endpoints (skips capability checks)
47
- - 'orchestrator' or 'or': Force use of Orchestrator endpoints (skips capability checks)
48
- - 'llmgateway' or 'gateway': Force use of LLMGateway endpoints (skips capability checks)
49
-
50
- Class Attributes:
51
- _base_url (str): The base URL for UiPath services, retrieved from the UIPATH_URL
52
- environment variable.
53
- _agenthub_available (Optional[bool]): Cached result of AgentHub availability check.
54
- _orchestrator_available (Optional[bool]): Cached result of Orchestrator availability check.
55
-
56
- Methods:
57
- is_agenthub_available(): Checks if AgentHub is available, caching the result.
58
- is_orchestrator_available(): Checks if Orchestrator is available, caching the result.
59
- get_passthrough_endpoint(): Returns the appropriate passthrough completion endpoint.
60
- get_normalized_endpoint(): Returns the appropriate normalized completion endpoint.
61
- get_embeddings_endpoint(): Returns the appropriate embeddings endpoint.
62
- All endpoint methods automatically select the best available endpoint using the fallback order,
63
- unless overridden by the UIPATH_LLM_SERVICE environment variable.
64
- """ # noqa: D205
65
-
66
- _base_url = os.getenv("UIPATH_URL", "")
67
- _agenthub_available: Optional[bool] = None
68
- _orchestrator_available: Optional[bool] = None
69
-
70
- @classmethod
71
- def is_agenthub_available(cls) -> bool:
72
- """Check if AgentHub is available and cache the result."""
73
- if cls._agenthub_available is None:
74
- cls._agenthub_available = cls._check_agenthub()
75
- return cls._agenthub_available
76
-
77
- @classmethod
78
- def is_orchestrator_available(cls) -> bool:
79
- """Check if Orchestrator is available and cache the result."""
80
- if cls._orchestrator_available is None:
81
- cls._orchestrator_available = cls._check_orchestrator()
82
- return cls._orchestrator_available
83
-
84
- @classmethod
85
- def _check_capabilities(cls, endpoint: UiPathEndpoints, service_name: str) -> bool:
86
- """Perform the actual check for service capabilities.
87
-
88
- Args:
89
- endpoint: The capabilities endpoint to check
90
- service_name: Human-readable service name for logging
91
-
92
- Returns:
93
- bool: True if the service is available and has valid capabilities
94
- """
95
- try:
96
- with httpx.Client(**get_httpx_client_kwargs()) as http_client:
97
- base_url = os.getenv("UIPATH_URL", "")
98
- capabilities_url = f"{base_url.rstrip('/')}/{endpoint.value}"
99
- loggger.debug(
100
- f"Checking {service_name} capabilities at {capabilities_url}"
101
- )
102
- response = http_client.get(capabilities_url)
103
-
104
- if response.status_code != 200:
105
- return False
106
-
107
- capabilities = response.json()
108
-
109
- # Validate structure and required fields
110
- if not isinstance(capabilities, dict) or "version" not in capabilities:
111
- return False
112
-
113
- return True
114
-
115
- except Exception as e:
116
- loggger.error(
117
- f"Error checking {service_name} capabilities: {e}", exc_info=True
118
- )
119
- return False
120
-
121
- @classmethod
122
- def _check_agenthub(cls) -> bool:
123
- """Perform the actual check for AgentHub capabilities."""
124
- return cls._check_capabilities(
125
- UiPathEndpoints.AH_CAPABILITIES_ENDPOINT, "AgentHub"
126
- )
127
-
128
- @classmethod
129
- def _check_orchestrator(cls) -> bool:
130
- """Perform the actual check for Orchestrator capabilities."""
131
- return cls._check_capabilities(
132
- UiPathEndpoints.OR_CAPABILITIES_ENDPOINT, "Orchestrator"
133
- )
134
-
135
- @classmethod
136
- def _select_endpoint(
137
- cls, ah: UiPathEndpoints, orc: UiPathEndpoints, gw: UiPathEndpoints
138
- ) -> str:
139
- """Select an endpoint based on UIPATH_LLM_SERVICE override or capability checks."""
140
- service_override = os.getenv("UIPATH_LLM_SERVICE", "").lower()
141
-
142
- if service_override in ("agenthub", "ah"):
143
- return ah.value
144
- if service_override in ("orchestrator", "or"):
145
- return orc.value
146
- if service_override in ("llmgateway", "gateway"):
147
- return gw.value
148
-
149
- # Determine fallback order based on environment hints
150
- hdens_env = os.getenv("HDENS_ENV", "").lower()
151
-
152
- # Default order: AgentHub -> Orchestrator
153
- check_order = [
154
- ("ah", ah, cls.is_agenthub_available),
155
- ("orc", orc, cls.is_orchestrator_available),
156
- ]
157
-
158
- # Prioritize Orchestrator if HDENS_ENV is 'sf'
159
- # Note: The default order already prioritizes AgentHub
160
- if hdens_env == "sf":
161
- check_order.reverse()
162
-
163
- # Execute fallback checks in the determined order
164
- for _, endpoint, is_available in check_order:
165
- if is_available():
166
- return endpoint.value
167
-
168
- # Final fallback to LLMGateway
169
- return gw.value
170
-
171
- @classmethod
172
- def get_passthrough_endpoint(cls) -> str:
173
- """Get the passthrough completion endpoint."""
174
- return cls._select_endpoint(
175
- UiPathEndpoints.AH_PASSTHROUGH_COMPLETION_ENDPOINT,
176
- UiPathEndpoints.OR_PASSTHROUGH_COMPLETION_ENDPOINT,
177
- UiPathEndpoints.LG_PASSTHROUGH_COMPLETION_ENDPOINT,
178
- )
179
-
180
- @classmethod
181
- def get_normalized_endpoint(cls) -> str:
182
- """Get the normalized completion endpoint."""
183
- return cls._select_endpoint(
184
- UiPathEndpoints.AH_NORMALIZED_COMPLETION_ENDPOINT,
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.132
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=tnF_FiCx8qI2XaJDQgYkMN_gl9V0VqNR1uX7iawuLp8,8230
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.132.dist-info/METADATA,sha256=8FYPPf1j2buYFFeGOD5x0pclG59w4lQaqTnl2Lr3TAk,6626
239
- uipath-2.1.132.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
240
- uipath-2.1.132.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
241
- uipath-2.1.132.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
242
- uipath-2.1.132.dist-info/RECORD,,
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,,