uipath 2.1.84__py3-none-any.whl → 2.1.85__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.

@@ -432,12 +432,12 @@ class UiPathEvalRuntime(UiPathBaseRuntime, Generic[T, C]):
432
432
  async def execute_runtime(
433
433
  self, eval_item: EvaluationItem
434
434
  ) -> UiPathEvalRunExecutionOutput:
435
- eval_item_id = eval_item.id
435
+ execution_id = str(uuid.uuid4())
436
436
  runtime_context: C = self.factory.new_context(
437
- execution_id=eval_item_id,
437
+ execution_id=execution_id,
438
438
  input_json=eval_item.inputs,
439
439
  is_eval_run=True,
440
- log_handler=self._setup_execution_logging(eval_item_id),
440
+ log_handler=self._setup_execution_logging(execution_id),
441
441
  )
442
442
  if runtime_context.execution_id is None:
443
443
  raise ValueError("execution_id must be set for eval runs")
@@ -445,9 +445,8 @@ class UiPathEvalRuntime(UiPathBaseRuntime, Generic[T, C]):
445
445
  attributes = {
446
446
  "evalId": eval_item.id,
447
447
  "span_type": "eval",
448
+ "execution.id": runtime_context.execution_id,
448
449
  }
449
- if runtime_context.execution_id:
450
- attributes["execution.id"] = runtime_context.execution_id
451
450
 
452
451
  start_time = time()
453
452
  try:
@@ -7,7 +7,7 @@ from httpx import Response
7
7
  from .._config import Config
8
8
  from .._execution_context import ExecutionContext
9
9
  from .._utils import Endpoint, RequestSpec, header_folder, infer_bindings
10
- from ..models import Connection, ConnectionToken, EventArguments
10
+ from ..models import Connection, ConnectionMetadata, ConnectionToken, EventArguments
11
11
  from ..models.connections import ConnectionTokenType
12
12
  from ..tracing._traced import traced
13
13
  from ._base_service import BaseService
@@ -54,6 +54,31 @@ class ConnectionsService(BaseService):
54
54
  response = self.request(spec.method, url=spec.endpoint)
55
55
  return Connection.model_validate(response.json())
56
56
 
57
+ @traced(
58
+ name="connections_metadata",
59
+ run_type="uipath",
60
+ hide_output=True,
61
+ )
62
+ def metadata(
63
+ self, element_instance_id: int, tool_path: str, schema_mode: bool = True
64
+ ) -> ConnectionMetadata:
65
+ """Synchronously retrieve connection API metadata.
66
+
67
+ This method fetches the metadata for a connection,
68
+ which can be used to establish communication with an external service.
69
+
70
+ Args:
71
+ element_instance_id (int): The element instance ID of the connection.
72
+ tool_path (str): The tool path to retrieve metadata for.
73
+ schema_mode (bool): Whether or not to represent the output schema in the response fields.
74
+
75
+ Returns:
76
+ ConnectionMetadata: The connection metadata.
77
+ """
78
+ spec = self._metadata_spec(element_instance_id, tool_path, schema_mode)
79
+ response = self.request(spec.method, url=spec.endpoint, headers=spec.headers)
80
+ return ConnectionMetadata.model_validate(response.json())
81
+
57
82
  @traced(name="connections_list", run_type="uipath")
58
83
  def list(
59
84
  self,
@@ -186,6 +211,33 @@ class ConnectionsService(BaseService):
186
211
  response = await self.request_async(spec.method, url=spec.endpoint)
187
212
  return Connection.model_validate(response.json())
188
213
 
214
+ @traced(
215
+ name="connections_metadata",
216
+ run_type="uipath",
217
+ hide_output=True,
218
+ )
219
+ async def metadata_async(
220
+ self, element_instance_id: int, tool_path: str, schema_mode: bool = True
221
+ ) -> ConnectionMetadata:
222
+ """Asynchronously retrieve connection API metadata.
223
+
224
+ This method fetches the metadata for a connection,
225
+ which can be used to establish communication with an external service.
226
+
227
+ Args:
228
+ element_instance_id (int): The element instance ID of the connection.
229
+ tool_path (str): The tool path to retrieve metadata for.
230
+ schema_mode (bool): Whether or not to represent the output schema in the response fields.
231
+
232
+ Returns:
233
+ ConnectionMetadata: The connection metadata.
234
+ """
235
+ spec = self._metadata_spec(element_instance_id, tool_path, schema_mode)
236
+ response = await self.request_async(
237
+ spec.method, url=spec.endpoint, headers=spec.headers
238
+ )
239
+ return ConnectionMetadata.model_validate(response.json())
240
+
189
241
  @traced(
190
242
  name="connections_retrieve_token",
191
243
  run_type="uipath",
@@ -324,6 +376,20 @@ class ConnectionsService(BaseService):
324
376
  endpoint=Endpoint(f"/connections_/api/v1/Connections/{key}"),
325
377
  )
326
378
 
379
+ def _metadata_spec(
380
+ self, element_instance_id: int, tool_path: str, schema_mode: bool
381
+ ) -> RequestSpec:
382
+ metadata_endpoint_url = f"/elements_/v3/element/instances/{element_instance_id}/elements/{tool_path}/metadata"
383
+ return RequestSpec(
384
+ method="GET",
385
+ endpoint=Endpoint(metadata_endpoint_url),
386
+ headers={
387
+ "accept": "application/schema+json"
388
+ if schema_mode
389
+ else "application/json"
390
+ },
391
+ )
392
+
327
393
  def _retrieve_token_spec(
328
394
  self, key: str, token_type: ConnectionTokenType = ConnectionTokenType.DIRECT
329
395
  ) -> RequestSpec:
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, EventArguments
6
+ from .connections import Connection, ConnectionMetadata, ConnectionToken, EventArguments
7
7
  from .context_grounding import ContextGroundingQueryResponse
8
8
  from .context_grounding_index import ContextGroundingIndex
9
9
  from .errors import BaseUrlMissingError, SecretMissingError
@@ -38,6 +38,7 @@ __all__ = [
38
38
  "QueueItemPriority",
39
39
  "TransactionItemResult",
40
40
  "Connection",
41
+ "ConnectionMetadata",
41
42
  "ConnectionToken",
42
43
  "EventArguments",
43
44
  "Job",
@@ -4,6 +4,14 @@ from typing import Any, Optional
4
4
  from pydantic import BaseModel, ConfigDict, Field
5
5
 
6
6
 
7
+ class ConnectionMetadata(BaseModel):
8
+ """Metadata about a connection."""
9
+
10
+ fields: dict[str, Any] = Field(default_factory=dict, alias="fields")
11
+
12
+ model_config = ConfigDict(populate_by_name=True, extra="allow")
13
+
14
+
7
15
  class Connection(BaseModel):
8
16
  model_config = ConfigDict(
9
17
  validate_by_name=True,
@@ -0,0 +1,111 @@
1
+ """Json schema to dynamic pydantic model."""
2
+
3
+ from typing import Any, Dict, List, Optional, Type, Union
4
+
5
+ from pydantic import BaseModel, Field, create_model
6
+
7
+
8
+ def jsonschema_to_pydantic(
9
+ schema: dict[str, Any],
10
+ definitions: Optional[dict[str, Any]] = None,
11
+ ) -> Type[BaseModel]:
12
+ """Convert a schema dict to a pydantic model.
13
+
14
+ Modified version of https://github.com/kreneskyp/jsonschema-pydantic to account for two unresolved issues.
15
+
16
+ Args:
17
+ schema: JSON schema.
18
+ definitions: Definitions dict. Defaults to `$def`.
19
+
20
+ Returns: Pydantic model.
21
+ """
22
+ title = schema.get("title", "DynamicModel")
23
+ assert isinstance(title, str), "Title of a model must be a string."
24
+
25
+ description = schema.get("description", None)
26
+
27
+ # top level schema provides definitions
28
+ if definitions is None:
29
+ if "$defs" in schema:
30
+ definitions = schema["$defs"]
31
+ elif "definitions" in schema:
32
+ definitions = schema["definitions"]
33
+ else:
34
+ definitions = {}
35
+
36
+ def convert_type(prop: dict[str, Any]) -> Any:
37
+ if "$ref" in prop:
38
+ ref_path = prop["$ref"].split("/")
39
+ ref = definitions[ref_path[-1]]
40
+ return jsonschema_to_pydantic(ref, definitions)
41
+
42
+ if "type" in prop:
43
+ type_mapping = {
44
+ "string": str,
45
+ "number": float,
46
+ "integer": int,
47
+ "boolean": bool,
48
+ "array": List,
49
+ "object": Dict[str, Any],
50
+ "null": None,
51
+ }
52
+
53
+ type_ = prop["type"]
54
+
55
+ if type_ == "array":
56
+ item_type: Any = convert_type(prop.get("items", {}))
57
+ assert isinstance(item_type, type)
58
+ return List[item_type] # noqa F821
59
+ elif type_ == "object":
60
+ if "properties" in prop:
61
+ return jsonschema_to_pydantic(prop, definitions)
62
+ else:
63
+ return Dict[str, Any]
64
+ else:
65
+ return type_mapping.get(type_, Any)
66
+
67
+ elif "allOf" in prop:
68
+ combined_fields = {}
69
+ for sub_schema in prop["allOf"]:
70
+ model = jsonschema_to_pydantic(sub_schema, definitions)
71
+ combined_fields.update(model.__annotations__)
72
+ return create_model("CombinedModel", **combined_fields)
73
+
74
+ elif "anyOf" in prop:
75
+ unioned_types = tuple(
76
+ convert_type(sub_schema) for sub_schema in prop["anyOf"]
77
+ )
78
+ return Union[unioned_types]
79
+ elif prop == {} or "type" not in prop:
80
+ return Any
81
+ else:
82
+ raise ValueError(f"Unsupported schema: {prop}")
83
+
84
+ fields: dict[str, Any] = {}
85
+ required_fields = schema.get("required", [])
86
+
87
+ for name, prop in schema.get("properties", {}).items():
88
+ pydantic_type = convert_type(prop)
89
+ field_kwargs = {}
90
+ if "default" in prop:
91
+ field_kwargs["default"] = prop["default"]
92
+ if name not in required_fields:
93
+ # Note that we do not make this optional. This is due to a limitation in Pydantic/Python.
94
+ # If we convert the Optional type back to json schema, it is represented as type | None.
95
+ # pydantic_type = Optional[pydantic_type]
96
+
97
+ if "default" not in field_kwargs:
98
+ field_kwargs["default"] = None
99
+ if "description" in prop:
100
+ field_kwargs["description"] = prop["description"]
101
+ if "title" in prop:
102
+ field_kwargs["title"] = prop["title"]
103
+
104
+ fields[name] = (pydantic_type, Field(**field_kwargs))
105
+
106
+ convert_type(schema.get("properties", {}).get("choices", {}))
107
+
108
+ model = create_model(title, **fields)
109
+ if description:
110
+ model.__doc__ = description
111
+ return model
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.1.84
3
+ Version: 2.1.85
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
@@ -46,7 +46,7 @@ uipath/_cli/_dev/_terminal/_utils/_logger.py,sha256=_ipTl_oAiMF9I7keGt2AAFAMz40D
46
46
  uipath/_cli/_evals/_console_progress_reporter.py,sha256=HgB6pdMyoS6YVwuI3EpM2LBcH3U69nrdaTyNgPG8ssg,9304
47
47
  uipath/_cli/_evals/_evaluator_factory.py,sha256=Gycv94VtGOpMir_Gba-UoiAyrSRfbSfe8_pTfjzcA9Q,3875
48
48
  uipath/_cli/_evals/_progress_reporter.py,sha256=kX7rNSa-QCLXIzK-vb9Jjf-XLEtucdeiQPgPlSkpp2U,16778
49
- uipath/_cli/_evals/_runtime.py,sha256=5pEAh8ebQFCBGJ-wEXQ0YeEvq3MGxGxRcxrT7kU2L6k,19882
49
+ uipath/_cli/_evals/_runtime.py,sha256=7ePUvkzaYC_sQUNmDgk1IqxvPpicjRlucQmSZkxHzc0,19834
50
50
  uipath/_cli/_evals/_span_collection.py,sha256=RoKoeDFG2XODdlgI27ionCjU7LLD_C0LJJ3gu0wab10,779
51
51
  uipath/_cli/_evals/_models/_evaluation_set.py,sha256=TEinpTAIzy5JLkF7-JrG_623ec2Y-GN9pfz284KKL_8,4567
52
52
  uipath/_cli/_evals/_models/_evaluator.py,sha256=fuC3UOYwPD4d_wdynHeLSCzbu82golNAnnPnxC8Y4rk,3315
@@ -97,7 +97,7 @@ uipath/_services/api_client.py,sha256=kGm04ijk9AOEQd2BMxvQg-2QoB8dmyoDwFFDPyutAG
97
97
  uipath/_services/assets_service.py,sha256=pG0Io--SeiRRQmfUWPQPl1vq3csZlQgx30LBNKRmmF8,12145
98
98
  uipath/_services/attachments_service.py,sha256=NPQYK7CGjfBaNT_1S5vEAfODmOChTbQZforllFM2ofU,26678
99
99
  uipath/_services/buckets_service.py,sha256=5s8tuivd7GUZYj774DDUYTa0axxlUuesc4EBY1V5sdk,18496
100
- uipath/_services/connections_service.py,sha256=IqhKdRYwNZlRsDL2vY7gyl5nAiYaK1zvj_CLa7WLzVQ,15785
100
+ uipath/_services/connections_service.py,sha256=tKJHHOKQYKR6LkgB-V_2d0vFpLEdFeMzwj_xmBVHUDw,18416
101
101
  uipath/_services/context_grounding_service.py,sha256=Pjx-QQQEiSKD-hY6ityj3QUSALN3fIcKLLHr_NZ0d_g,37117
102
102
  uipath/_services/documents_service.py,sha256=UnFS8EpOZ_Ng2TZk3OiJJ3iNANvFs7QxuoG_v-lQj6c,24815
103
103
  uipath/_services/entities_service.py,sha256=QKCLE6wRgq3HZraF-M2mljy-8il4vsNHrQhUgkewVVk,14028
@@ -144,14 +144,14 @@ uipath/eval/mocks/__init__.py,sha256=Qis6XSN7_WOmrmD_I5Fo5E_OQpflb_SlZM_MDOszUXI
144
144
  uipath/eval/mocks/mockable.py,sha256=FJEE4iz6nchowGhoGR3FgF9VvymHnWJkUyakKOK4fIg,3360
145
145
  uipath/eval/models/__init__.py,sha256=x360CDZaRjUL3q3kh2CcXYYrQ47jwn6p6JnmhEIvMlA,419
146
146
  uipath/eval/models/models.py,sha256=YgPnkQunjEcEiueVQnYRsbQ3Nj1yQttDQZiMCq_DDkY,6321
147
- uipath/models/__init__.py,sha256=d_DkK1AtRUetM1t2NrH5UKgvJOBiynzaKnK5pMY7aIc,1289
147
+ uipath/models/__init__.py,sha256=au-Bhk7w4Jl8Jn-_a1Ae30RX9N6eQJJ0-bd-QSbRiuU,1335
148
148
  uipath/models/action_schema.py,sha256=tBn1qQ3NQLU5nwWlBIzIKIx3XK5pO_D1S51IjFlZ1FA,610
149
149
  uipath/models/actions.py,sha256=1vRsJ3JSmMdPkbiYAiHzY8K44vmW3VlMsmQUBAkSgrQ,3141
150
150
  uipath/models/assets.py,sha256=7x3swJRnG_a4VgjdXKKwraJLT5TF0u4wHsl6coOjX0g,2762
151
151
  uipath/models/attachment.py,sha256=lI6BxBY6DY5U6qZbxhkNu-usseA1zovYSTRtLq50ubI,1029
152
152
  uipath/models/auth.py,sha256=-CEo5KZVtZZgbAMatN6B1vBmGp8lTTumR8sMthRmL8I,345
153
153
  uipath/models/buckets.py,sha256=N3Lj_dVCv709-ywhOOdyCSvsuLn41eGuAfSiik6Q6F8,1285
154
- uipath/models/connections.py,sha256=bTDg8xISSPmKB1GFNEEMD1OEZyBDFHfZVKqw4gab1pE,2524
154
+ uipath/models/connections.py,sha256=jmzlfnddqlxjmiVhqsETRV6TQPH3fFqJGsygG0gUf7g,2745
155
155
  uipath/models/context_grounding.py,sha256=3MaF2Fv2QYle8UUWvKGkCN5XGpx2T4a34fdbBqJ2fCs,1137
156
156
  uipath/models/context_grounding_index.py,sha256=OhRyxZDHDSrEmBFK0-JLqMMMT64jir4XkHtQ54IKtc0,2683
157
157
  uipath/models/documents.py,sha256=g3xAhZlGcLuD6a_DHcUQWoLdzh5dENulouYAwrjGHEw,3963
@@ -172,8 +172,9 @@ uipath/tracing/_traced.py,sha256=yBIY05PCCrYyx50EIHZnwJaKNdHPNx-YTR1sHQl0a98,199
172
172
  uipath/tracing/_utils.py,sha256=X-LFsyIxDeNOGuHPvkb6T5o9Y8ElYhr_rP3CEBJSu4s,13837
173
173
  uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
174
174
  uipath/utils/_endpoints_manager.py,sha256=iRTl5Q0XAm_YgcnMcJOXtj-8052sr6jpWuPNz6CgT0Q,8408
175
- uipath-2.1.84.dist-info/METADATA,sha256=qoHn0sW3KLxB59TgARTElWJm91_930iMUEY-XLpgjaA,6593
176
- uipath-2.1.84.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
177
- uipath-2.1.84.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
178
- uipath-2.1.84.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
179
- uipath-2.1.84.dist-info/RECORD,,
175
+ uipath/utils/dynamic_schema.py,sha256=w0u_54MoeIAB-mf3GmwX1A_X8_HDrRy6p998PvX9evY,3839
176
+ uipath-2.1.85.dist-info/METADATA,sha256=jcwWDDU5E1A7FmIZgfvvmg8tWpkZ3KZuu91Ou0aWrwM,6593
177
+ uipath-2.1.85.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
178
+ uipath-2.1.85.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
179
+ uipath-2.1.85.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
180
+ uipath-2.1.85.dist-info/RECORD,,