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

@@ -210,7 +210,7 @@ class StudioWebProgressReporter:
210
210
  }
211
211
 
212
212
  @gracefully_handle_errors
213
- async def create_eval_set_run(
213
+ async def create_eval_set_run_sw(
214
214
  self,
215
215
  eval_set_id: str,
216
216
  agent_snapshot: StudioWebAgentSnapshot,
@@ -352,13 +352,15 @@ class StudioWebProgressReporter:
352
352
  is_coded = self._is_coded_evaluator(payload.evaluators)
353
353
  self.is_coded_eval[payload.execution_id] = is_coded
354
354
 
355
- eval_set_run_id = await self.create_eval_set_run(
356
- eval_set_id=payload.eval_set_id,
357
- agent_snapshot=self._extract_agent_snapshot(payload.entrypoint),
358
- no_of_evals=payload.no_of_evals,
359
- evaluators=payload.evaluators,
360
- is_coded=is_coded,
361
- )
355
+ eval_set_run_id = payload.eval_set_run_id
356
+ if not eval_set_run_id:
357
+ eval_set_run_id = await self.create_eval_set_run_sw(
358
+ eval_set_id=payload.eval_set_id,
359
+ agent_snapshot=self._extract_agent_snapshot(payload.entrypoint),
360
+ no_of_evals=payload.no_of_evals,
361
+ evaluators=payload.evaluators,
362
+ is_coded=is_coded,
363
+ )
362
364
  self.eval_set_run_ids[payload.execution_id] = eval_set_run_id
363
365
  current_span = trace.get_current_span()
364
366
  if current_span.is_recording():
@@ -151,6 +151,7 @@ class UiPathEvalContext(UiPathRuntimeContext):
151
151
  workers: Optional[int] = 1
152
152
  eval_set: Optional[str] = None
153
153
  eval_ids: Optional[List[str]] = None
154
+ eval_set_run_id: Optional[str] = None
154
155
  verbose: bool = False
155
156
 
156
157
 
@@ -214,6 +215,7 @@ class UiPathEvalRuntime(UiPathBaseRuntime, Generic[T, C]):
214
215
  EvalSetRunCreatedEvent(
215
216
  execution_id=self.execution_id,
216
217
  entrypoint=self.context.entrypoint or "",
218
+ eval_set_run_id=self.context.eval_set_run_id,
217
219
  eval_set_id=evaluation_set.id,
218
220
  no_of_evals=len(evaluation_set.evaluations),
219
221
  evaluators=evaluators,
@@ -45,8 +45,6 @@ PYTHON_BINARY_EXTENSIONS = {".pickle", ".pkl"}
45
45
 
46
46
  SPECIAL_EXTENSIONS = {""} # Extensionless binary files
47
47
 
48
- UIPATH_PROJECT_ID = "UIPATH_PROJECT_ID"
49
-
50
48
  # Pre-compute the union for optimal performance
51
49
  BINARY_EXTENSIONS = (
52
50
  IMAGE_EXTENSIONS
uipath/_cli/cli_eval.py CHANGED
@@ -12,9 +12,9 @@ from uipath._cli._evals._runtime import (
12
12
  UiPathEvalContext,
13
13
  )
14
14
  from uipath._cli._runtime._runtime_factory import generate_runtime_factory
15
- from uipath._cli._utils._constants import UIPATH_PROJECT_ID
16
15
  from uipath._cli._utils._folders import get_personal_workspace_key_async
17
16
  from uipath._cli.middlewares import Middlewares
17
+ from uipath._config import UiPathConfig
18
18
  from uipath._events._event_bus import EventBus
19
19
  from uipath.eval._helpers import auto_discover_entrypoint
20
20
  from uipath.tracing import LlmOpsHttpExporter
@@ -39,12 +39,13 @@ def setup_reporting_prereq(no_report: bool) -> bool:
39
39
  if no_report:
40
40
  return False
41
41
 
42
- if not os.getenv(UIPATH_PROJECT_ID, False):
42
+ if not UiPathConfig.is_studio_project:
43
43
  console.warning(
44
44
  "UIPATH_PROJECT_ID environment variable not set. Results will no be reported to Studio Web."
45
45
  )
46
46
  return False
47
- if not os.getenv("UIPATH_FOLDER_KEY"):
47
+
48
+ if not UiPathConfig.folder_key:
48
49
  folder_key = asyncio.run(get_personal_workspace_key_async())
49
50
  if folder_key:
50
51
  os.environ["UIPATH_FOLDER_KEY"] = folder_key
@@ -55,6 +56,12 @@ def setup_reporting_prereq(no_report: bool) -> bool:
55
56
  @click.argument("entrypoint", required=False)
56
57
  @click.argument("eval_set", required=False)
57
58
  @click.option("--eval-ids", cls=LiteralOption, default="[]")
59
+ @click.option(
60
+ "--eval-set-run-id",
61
+ required=False,
62
+ type=str,
63
+ help="Custom evaluation set run ID (if not provided, a UUID will be generated)",
64
+ )
58
65
  @click.option(
59
66
  "--no-report",
60
67
  is_flag=True,
@@ -78,6 +85,7 @@ def eval(
78
85
  entrypoint: Optional[str],
79
86
  eval_set: Optional[str],
80
87
  eval_ids: List[str],
88
+ eval_set_run_id: Optional[str],
81
89
  no_report: bool,
82
90
  workers: int,
83
91
  output_file: Optional[str],
@@ -88,6 +96,7 @@ def eval(
88
96
  entrypoint: Path to the agent script to evaluate (optional, will auto-discover if not specified)
89
97
  eval_set: Path to the evaluation set JSON file (optional, will auto-discover if not specified)
90
98
  eval_ids: Optional list of evaluation IDs
99
+ eval_set_run_id: Custom evaluation set run ID (optional, will generate UUID if not specified)
91
100
  workers: Number of parallel workers for running evaluations
92
101
  no_report: Do not report the evaluation results
93
102
  """
@@ -95,6 +104,7 @@ def eval(
95
104
  "entrypoint": entrypoint or auto_discover_entrypoint(),
96
105
  "eval_set": eval_set,
97
106
  "eval_ids": eval_ids,
107
+ "eval_set_run_id": eval_set_run_id,
98
108
  "workers": workers,
99
109
  "no_report": no_report,
100
110
  "output_file": output_file,
@@ -130,6 +140,7 @@ def eval(
130
140
 
131
141
  eval_context.no_report = no_report
132
142
  eval_context.workers = workers
143
+ eval_context.eval_set_run_id = eval_set_run_id
133
144
 
134
145
  # Load eval set to resolve the path
135
146
  eval_set_path = eval_set or EvalHelpers.auto_discover_eval_set()
uipath/_cli/cli_init.py CHANGED
@@ -10,6 +10,7 @@ from typing import Any, Dict, Optional
10
10
 
11
11
  import click
12
12
 
13
+ from .._config import UiPathConfig
13
14
  from .._utils.constants import ENV_TELEMETRY_ENABLED
14
15
  from ..telemetry import track
15
16
  from ..telemetry._constants import _PROJECT_KEY, _TELEMETRY_CONFIG_FILE
@@ -43,9 +44,7 @@ def create_telemetry_config_file(target_directory: str) -> None:
43
44
  return
44
45
 
45
46
  os.makedirs(uipath_dir, exist_ok=True)
46
- telemetry_data = {
47
- _PROJECT_KEY: os.getenv("UIPATH_PROJECT_ID", None) or str(uuid.uuid4())
48
- }
47
+ telemetry_data = {_PROJECT_KEY: UiPathConfig.project_id or str(uuid.uuid4())}
49
48
 
50
49
  with open(telemetry_file, "w") as f:
51
50
  json.dump(telemetry_data, f, indent=4)
uipath/_cli/cli_pack.py CHANGED
@@ -8,8 +8,8 @@ from string import Template
8
8
  import click
9
9
  from pydantic import TypeAdapter
10
10
 
11
- from uipath._cli._utils._constants import UIPATH_PROJECT_ID
12
11
  from uipath._cli.models.runtime_schema import Bindings, RuntimeSchema
12
+ from uipath._config import UiPathConfig
13
13
 
14
14
  from ..telemetry import track
15
15
  from ..telemetry._constants import _PROJECT_KEY, _TELEMETRY_CONFIG_FILE
@@ -35,8 +35,8 @@ def get_project_id() -> str:
35
35
  Project ID string (either from telemetry file or newly generated).
36
36
  """
37
37
  # first check if this is a studio project
38
- if os.getenv(UIPATH_PROJECT_ID, None):
39
- return os.getenv(UIPATH_PROJECT_ID)
38
+ if project_id := UiPathConfig.project_id:
39
+ return project_id
40
40
 
41
41
  telemetry_file = os.path.join(".uipath", _TELEMETRY_CONFIG_FILE)
42
42
 
uipath/_cli/cli_pull.py CHANGED
@@ -11,14 +11,13 @@ It handles:
11
11
 
12
12
  # type: ignore
13
13
  import asyncio
14
- import os
15
14
  from pathlib import Path
16
15
 
17
16
  import click
18
17
 
18
+ from .._config import UiPathConfig
19
19
  from ..telemetry import track
20
20
  from ._utils._console import ConsoleLogger
21
- from ._utils._constants import UIPATH_PROJECT_ID
22
21
  from ._utils._project_files import ProjectPullError, pull_project
23
22
 
24
23
  console = ConsoleLogger()
@@ -49,10 +48,9 @@ def pull(root: Path) -> None:
49
48
  $ uipath pull
50
49
  $ uipath pull /path/to/project
51
50
  """
52
- project_id = os.getenv(UIPATH_PROJECT_ID)
51
+ project_id = UiPathConfig.project_id
53
52
  if not project_id:
54
53
  console.error("UIPATH_PROJECT_ID environment variable not found.")
55
- return
56
54
 
57
55
  download_configuration = {
58
56
  "source_code": root,
uipath/_cli/cli_push.py CHANGED
@@ -1,6 +1,5 @@
1
1
  # type: ignore
2
2
  import asyncio
3
- import os
4
3
  from typing import Any, AsyncIterator, Optional
5
4
  from urllib.parse import urlparse
6
5
 
@@ -8,12 +7,10 @@ import click
8
7
 
9
8
  from uipath.models.exceptions import EnrichedException
10
9
 
10
+ from .._config import UiPathConfig
11
11
  from ..telemetry import track
12
12
  from ._push.sw_file_handler import FileOperationUpdate, SwFileHandler
13
13
  from ._utils._console import ConsoleLogger
14
- from ._utils._constants import (
15
- UIPATH_PROJECT_ID,
16
- )
17
14
  from ._utils._project_files import (
18
15
  ensure_config_file,
19
16
  get_project_config,
@@ -99,7 +96,7 @@ def push(root: str, nolock: bool) -> None:
99
96
  config = get_project_config(root)
100
97
  validate_config(config)
101
98
 
102
- project_id = os.getenv(UIPATH_PROJECT_ID)
99
+ project_id = UiPathConfig.project_id
103
100
  if not project_id:
104
101
  console.error("UIPATH_PROJECT_ID environment variable not found.")
105
102
 
uipath/_config.py CHANGED
@@ -1,6 +1,44 @@
1
+ import os
2
+ from pathlib import Path
3
+ from typing import Optional
4
+
1
5
  from pydantic import BaseModel
2
6
 
3
7
 
4
8
  class Config(BaseModel):
5
9
  base_url: str
6
10
  secret: str
11
+
12
+
13
+ class ConfigurationManager:
14
+ _instance = None
15
+
16
+ def __new__(cls):
17
+ if cls._instance is None:
18
+ cls._instance = super().__new__(cls)
19
+ return cls._instance
20
+
21
+ @property
22
+ def bindings_file_path(self) -> Path:
23
+ from uipath._utils.constants import UIPATH_BINDINGS_FILE
24
+
25
+ return Path(UIPATH_BINDINGS_FILE)
26
+
27
+ @property
28
+ def project_id(self) -> Optional[str]:
29
+ from uipath._utils.constants import ENV_UIPATH_PROJECT_ID
30
+
31
+ return os.getenv(ENV_UIPATH_PROJECT_ID, None)
32
+
33
+ @property
34
+ def folder_key(self) -> Optional[str]:
35
+ from uipath._utils.constants import ENV_FOLDER_KEY
36
+
37
+ return os.getenv(ENV_FOLDER_KEY, None)
38
+
39
+ @property
40
+ def is_studio_project(self) -> bool:
41
+ return self.project_id is not None
42
+
43
+
44
+ UiPathConfig = ConfigurationManager()
uipath/_events/_events.py CHANGED
@@ -20,6 +20,7 @@ class EvalSetRunCreatedEvent(BaseModel):
20
20
  execution_id: str
21
21
  entrypoint: str
22
22
  eval_set_id: str
23
+ eval_set_run_id: Optional[str] = None
23
24
  no_of_evals: int
24
25
  # skip validation to avoid abstract class instantiation
25
26
  evaluators: SkipValidation[List[AnyEvaluator]]
@@ -100,6 +100,7 @@ uv run uipath run --resume
100
100
  entrypoint: Path to the agent script to evaluate (optional, will auto-discover if not specified)
101
101
  eval_set: Path to the evaluation set JSON file (optional, will auto-discover if not specified)
102
102
  eval_ids: Optional list of evaluation IDs
103
+ eval_set_run_id: Custom evaluation set run ID (optional, will generate UUID if not specified)
103
104
  workers: Number of parallel workers for running evaluations
104
105
  no_report: Do not report the evaluation results
105
106
 
@@ -115,6 +116,7 @@ uv run uipath run --resume
115
116
 
116
117
  | Option | Type | Default | Description |
117
118
  |--------|------|---------|-------------|
119
+ | `--eval-set-run-id` | value | `Sentinel.UNSET` | Custom evaluation set run ID (if not provided, a UUID will be generated) |
118
120
  | `--no-report` | flag | false | Do not report the evaluation results |
119
121
  | `--workers` | value | `1` | Number of parallel workers for running evaluations (default: 1) |
120
122
  | `--output-file` | value | `Sentinel.UNSET` | File path where the output will be written |
@@ -124,17 +124,23 @@ sdk.context_grounding.search_async(name: str, query: str, number_of_results: int
124
124
  Documents service
125
125
 
126
126
  ```python
127
+ # Classify a document using a DU Modern project.
128
+ sdk.documents.classify(tag: str, project_name: str, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None) -> typing.List[uipath.models.documents.ClassificationResult]
129
+
130
+ # Asynchronously version of the [`classify`][uipath._services.documents_service.DocumentsService.classify] method.
131
+ sdk.documents.classify_async(tag: str, project_name: str, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None) -> typing.List[uipath.models.documents.ClassificationResult]
132
+
127
133
  # Create a validation action for a document based on the extraction response. More details about validation actions can be found in the [official documentation](https://docs.uipath.com/ixp/automation-cloud/latest/user-guide/validating-extractions).
128
134
  sdk.documents.create_validation_action(action_title: str, action_priority: <enum 'ActionPriority, action_catalog: str, action_folder: str, storage_bucket_name: str, storage_bucket_directory_path: str, extraction_response: uipath.models.documents.ExtractionResponse) -> uipath.models.documents.ValidationAction
129
135
 
130
136
  # Asynchronous version of the [`create_validation_action`][uipath._services.documents_service.DocumentsService.create_validation_action] method.
131
137
  sdk.documents.create_validation_action_async(action_title: str, action_priority: <enum 'ActionPriority, action_catalog: str, action_folder: str, storage_bucket_name: str, storage_bucket_directory_path: str, extraction_response: uipath.models.documents.ExtractionResponse) -> uipath.models.documents.ValidationAction
132
138
 
133
- # Extract predicted data from a document using an IXP project.
134
- sdk.documents.extract(project_name: str, tag: str, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None, project_type: <enum 'ProjectType="IXP", document_type_name: Optional[str]=None) -> typing.Union[uipath.models.documents.ExtractionResponse, uipath.models.documents.ExtractionResponseIXP]
139
+ # Extract predicted data from a document using an DU Modern/IXP project.
140
+ sdk.documents.extract(tag: str, project_name: Optional[str]=None, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None, classification_result: Optional[uipath.models.documents.ClassificationResult]=None, project_type: Optional[uipath.models.documents.ProjectType]=None, document_type_name: Optional[str]=None) -> typing.Union[uipath.models.documents.ExtractionResponse, uipath.models.documents.ExtractionResponseIXP]
135
141
 
136
142
  # Asynchronously version of the [`extract`][uipath._services.documents_service.DocumentsService.extract] method.
137
- sdk.documents.extract_async(project_name: str, tag: str, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None, project_type: <enum 'ProjectType="IXP", document_type_name: Optional[str]=None) -> typing.Union[uipath.models.documents.ExtractionResponse, uipath.models.documents.ExtractionResponseIXP]
143
+ sdk.documents.extract_async(tag: str, project_name: Optional[str]=None, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None, classification_result: Optional[uipath.models.documents.ClassificationResult]=None, project_type: Optional[uipath.models.documents.ProjectType]=None, document_type_name: Optional[str]=None) -> typing.Union[uipath.models.documents.ExtractionResponse, uipath.models.documents.ExtractionResponseIXP]
138
144
 
139
145
  # Get the result of a validation action.
140
146
  sdk.documents.get_validation_result(validation_action: uipath.models.documents.ValidationAction) -> uipath.models.documents.ValidatedResult