uipath 2.0.0.dev2__py3-none-any.whl → 2.0.1__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.

Files changed (76) hide show
  1. uipath/__init__.py +24 -0
  2. uipath/_cli/README.md +11 -0
  3. uipath/_cli/__init__.py +54 -0
  4. uipath/_cli/_auth/_auth_server.py +165 -0
  5. uipath/_cli/_auth/_models.py +51 -0
  6. uipath/_cli/_auth/_oidc_utils.py +69 -0
  7. uipath/_cli/_auth/_portal_service.py +163 -0
  8. uipath/_cli/_auth/_utils.py +51 -0
  9. uipath/_cli/_auth/auth_config.json +6 -0
  10. uipath/_cli/_auth/index.html +167 -0
  11. uipath/_cli/_auth/localhost.crt +25 -0
  12. uipath/_cli/_auth/localhost.key +27 -0
  13. uipath/_cli/_runtime/_contracts.py +429 -0
  14. uipath/_cli/_runtime/_logging.py +193 -0
  15. uipath/_cli/_runtime/_runtime.py +264 -0
  16. uipath/_cli/_templates/.psmdcp.template +9 -0
  17. uipath/_cli/_templates/.rels.template +5 -0
  18. uipath/_cli/_templates/[Content_Types].xml.template +9 -0
  19. uipath/_cli/_templates/main.py.template +25 -0
  20. uipath/_cli/_templates/package.nuspec.template +10 -0
  21. uipath/_cli/_utils/_common.py +24 -0
  22. uipath/_cli/_utils/_input_args.py +126 -0
  23. uipath/_cli/_utils/_parse_ast.py +542 -0
  24. uipath/_cli/cli_auth.py +97 -0
  25. uipath/_cli/cli_deploy.py +13 -0
  26. uipath/_cli/cli_init.py +113 -0
  27. uipath/_cli/cli_new.py +76 -0
  28. uipath/_cli/cli_pack.py +337 -0
  29. uipath/_cli/cli_publish.py +113 -0
  30. uipath/_cli/cli_run.py +133 -0
  31. uipath/_cli/middlewares.py +113 -0
  32. uipath/_config.py +6 -0
  33. uipath/_execution_context.py +83 -0
  34. uipath/_folder_context.py +62 -0
  35. uipath/_models/__init__.py +37 -0
  36. uipath/_models/action_schema.py +26 -0
  37. uipath/_models/actions.py +64 -0
  38. uipath/_models/assets.py +48 -0
  39. uipath/_models/connections.py +51 -0
  40. uipath/_models/context_grounding.py +18 -0
  41. uipath/_models/context_grounding_index.py +60 -0
  42. uipath/_models/exceptions.py +6 -0
  43. uipath/_models/interrupt_models.py +28 -0
  44. uipath/_models/job.py +66 -0
  45. uipath/_models/llm_gateway.py +101 -0
  46. uipath/_models/processes.py +48 -0
  47. uipath/_models/queues.py +167 -0
  48. uipath/_services/__init__.py +26 -0
  49. uipath/_services/_base_service.py +250 -0
  50. uipath/_services/actions_service.py +271 -0
  51. uipath/_services/api_client.py +89 -0
  52. uipath/_services/assets_service.py +257 -0
  53. uipath/_services/buckets_service.py +268 -0
  54. uipath/_services/connections_service.py +185 -0
  55. uipath/_services/connections_service.pyi +50 -0
  56. uipath/_services/context_grounding_service.py +402 -0
  57. uipath/_services/folder_service.py +49 -0
  58. uipath/_services/jobs_service.py +265 -0
  59. uipath/_services/llm_gateway_service.py +311 -0
  60. uipath/_services/processes_service.py +168 -0
  61. uipath/_services/queues_service.py +314 -0
  62. uipath/_uipath.py +98 -0
  63. uipath/_utils/__init__.py +17 -0
  64. uipath/_utils/_endpoint.py +79 -0
  65. uipath/_utils/_infer_bindings.py +30 -0
  66. uipath/_utils/_logs.py +15 -0
  67. uipath/_utils/_request_override.py +18 -0
  68. uipath/_utils/_request_spec.py +23 -0
  69. uipath/_utils/_user_agent.py +16 -0
  70. uipath/_utils/constants.py +25 -0
  71. uipath/py.typed +0 -0
  72. {uipath-2.0.0.dev2.dist-info → uipath-2.0.1.dist-info}/METADATA +2 -3
  73. uipath-2.0.1.dist-info/RECORD +75 -0
  74. uipath-2.0.0.dev2.dist-info/RECORD +0 -4
  75. {uipath-2.0.0.dev2.dist-info → uipath-2.0.1.dist-info}/WHEEL +0 -0
  76. {uipath-2.0.0.dev2.dist-info → uipath-2.0.1.dist-info}/entry_points.txt +0 -0
uipath/_cli/cli_run.py ADDED
@@ -0,0 +1,133 @@
1
+ # type: ignore
2
+ import asyncio
3
+ import logging
4
+ import os
5
+ import traceback
6
+ from os import environ as env
7
+ from typing import Optional
8
+ from uuid import uuid4
9
+
10
+ import click
11
+ from dotenv import load_dotenv
12
+
13
+ from ._runtime._contracts import (
14
+ UiPathRuntimeContext,
15
+ UiPathRuntimeError,
16
+ UiPathTraceContext,
17
+ )
18
+ from ._runtime._runtime import UiPathRuntime
19
+ from .middlewares import MiddlewareResult, Middlewares
20
+
21
+ logger = logging.getLogger(__name__)
22
+ load_dotenv()
23
+
24
+
25
+ def python_run_middleware(
26
+ entrypoint: Optional[str], input: Optional[str], resume: bool
27
+ ) -> MiddlewareResult:
28
+ """Middleware to handle Python script execution.
29
+
30
+ Args:
31
+ entrypoint: Path to the Python script to execute
32
+ input: JSON string with input data
33
+ resume: Flag indicating if this is a resume execution
34
+
35
+ Returns:
36
+ MiddlewareResult with execution status and messages
37
+ """
38
+ if not entrypoint:
39
+ return MiddlewareResult(
40
+ should_continue=False,
41
+ info_message="""Error: No entrypoint specified. Please provide a path to a Python script.
42
+ Usage: `uipath run <entrypoint_path> <input_arguments>`""",
43
+ )
44
+
45
+ if not os.path.exists(entrypoint):
46
+ return MiddlewareResult(
47
+ should_continue=False,
48
+ error_message=f"""Error: Script not found at path {entrypoint}.
49
+ Usage: `uipath run <entrypoint_path> <input_arguments>`""",
50
+ )
51
+
52
+ try:
53
+
54
+ async def execute():
55
+ context = UiPathRuntimeContext.from_config(
56
+ env.get("UIPATH_CONFIG_PATH", "uipath.json")
57
+ )
58
+ context.entrypoint = entrypoint
59
+ context.input = input
60
+ context.resume = resume
61
+ context.job_id = env.get("UIPATH_JOB_KEY")
62
+ context.trace_id = env.get("UIPATH_TRACE_ID")
63
+ context.tracing_enabled = env.get("UIPATH_TRACING_ENABLED", True)
64
+ context.trace_context = UiPathTraceContext(
65
+ trace_id=env.get("UIPATH_TRACE_ID"),
66
+ parent_span_id=env.get("UIPATH_PARENT_SPAN_ID"),
67
+ root_span_id=env.get("UIPATH_ROOT_SPAN_ID"),
68
+ enabled=env.get("UIPATH_TRACING_ENABLED", True),
69
+ job_id=env.get("UIPATH_JOB_KEY"),
70
+ org_id=env.get("UIPATH_ORGANIZATION_ID"),
71
+ tenant_id=env.get("UIPATH_TENANT_ID"),
72
+ process_key=env.get("UIPATH_PROCESS_UUID"),
73
+ folder_key=env.get("UIPATH_FOLDER_KEY"),
74
+ reference_id=env.get("UIPATH_JOB_KEY") or str(uuid4()),
75
+ )
76
+ context.logs_min_level = env.get("LOG_LEVEL", "INFO")
77
+
78
+ async with UiPathRuntime.from_context(context) as runtime:
79
+ await runtime.execute()
80
+
81
+ asyncio.run(execute())
82
+
83
+ # Return success
84
+ return MiddlewareResult(should_continue=False)
85
+
86
+ except UiPathRuntimeError as e:
87
+ return MiddlewareResult(
88
+ should_continue=False,
89
+ error_message=f"Error: {e.error_info.title} - {e.error_info.detail}",
90
+ should_include_stacktrace=False,
91
+ )
92
+ except Exception as e:
93
+ # Handle unexpected errors
94
+ logger.exception("Unexpected error in Python runtime middleware")
95
+ return MiddlewareResult(
96
+ should_continue=False,
97
+ error_message=f"Error: Unexpected error occurred - {str(e)}",
98
+ should_include_stacktrace=True,
99
+ )
100
+
101
+
102
+ @click.command()
103
+ @click.argument("entrypoint", required=False)
104
+ @click.argument("input", required=False, default="{}")
105
+ @click.option("--resume", is_flag=True, help="Resume execution from a previous state")
106
+ def run(entrypoint: Optional[str], input: Optional[str], resume: bool) -> None:
107
+ """Execute a Python script with JSON input."""
108
+ # Process through middleware chain
109
+ result = Middlewares.next("run", entrypoint, input, resume)
110
+
111
+ if result.should_continue:
112
+ result = python_run_middleware(
113
+ entrypoint=entrypoint, input=input, resume=resume
114
+ )
115
+
116
+ # Handle result from middleware
117
+ if result.error_message:
118
+ click.echo(result.error_message)
119
+ if result.should_include_stacktrace:
120
+ click.echo(traceback.format_exc())
121
+ click.get_current_context().exit(1)
122
+
123
+ if result.info_message:
124
+ click.echo(result.info_message)
125
+
126
+ # If middleware chain completed but didn't handle the request
127
+ if result.should_continue:
128
+ click.echo("Error: Could not process the request with any available handler.")
129
+ click.get_current_context().exit(1)
130
+
131
+
132
+ if __name__ == "__main__":
133
+ run()
@@ -0,0 +1,113 @@
1
+ import importlib.metadata
2
+ import logging
3
+ from dataclasses import dataclass
4
+ from typing import Any, Callable, Dict, List, Optional
5
+
6
+ logger = logging.getLogger(__name__)
7
+
8
+
9
+ @dataclass
10
+ class MiddlewareResult:
11
+ should_continue: bool
12
+ info_message: Optional[str] = None
13
+ error_message: Optional[str] = None
14
+ should_include_stacktrace: bool = False
15
+
16
+
17
+ MiddlewareFunc = Callable[..., MiddlewareResult]
18
+
19
+
20
+ class Middlewares:
21
+ _middlewares: Dict[str, List[MiddlewareFunc]] = {
22
+ "new": [],
23
+ "init": [],
24
+ "pack": [],
25
+ "publish": [],
26
+ "run": [],
27
+ }
28
+ _plugins_loaded = False
29
+
30
+ @classmethod
31
+ def register(cls, command: str, middleware: MiddlewareFunc) -> None:
32
+ """Register a middleware for a specific command."""
33
+ if command not in cls._middlewares:
34
+ cls._middlewares[command] = []
35
+ cls._middlewares[command].append(middleware)
36
+ logger.debug(
37
+ f"Registered middleware for command '{command}': {middleware.__name__}"
38
+ )
39
+
40
+ @classmethod
41
+ def get(cls, command: str) -> List[MiddlewareFunc]:
42
+ """Get all middlewares for a specific command."""
43
+ return cls._middlewares.get(command, [])
44
+
45
+ @classmethod
46
+ def next(cls, command: str, *args: Any, **kwargs: Any) -> MiddlewareResult:
47
+ """Invoke middleware."""
48
+ if not cls._plugins_loaded:
49
+ cls.load_plugins()
50
+
51
+ middlewares = cls.get(command)
52
+ for middleware in middlewares:
53
+ try:
54
+ result = middleware(*args, **kwargs)
55
+ if not result.should_continue:
56
+ logger.debug(
57
+ f"Command '{command}' stopped by {middleware.__name__}"
58
+ )
59
+ return result
60
+ except Exception as e:
61
+ logger.error(f"Middleware {middleware.__name__} failed: {str(e)}")
62
+ raise
63
+ return MiddlewareResult(should_continue=True)
64
+
65
+ @classmethod
66
+ def clear(cls, command: Optional[str] = None) -> None:
67
+ """Clear middlewares for a specific command or all middlewares if command is None."""
68
+ if command:
69
+ if command in cls._middlewares:
70
+ cls._middlewares[command] = []
71
+ else:
72
+ for cmd in cls._middlewares:
73
+ cls._middlewares[cmd] = []
74
+
75
+ @classmethod
76
+ def load_plugins(cls) -> None:
77
+ """Load all middlewares registered via entry points."""
78
+ if cls._plugins_loaded:
79
+ return
80
+
81
+ try:
82
+ try:
83
+ entry_points = importlib.metadata.entry_points()
84
+ if hasattr(entry_points, "select"):
85
+ middlewares = list(entry_points.select(group="uipath.middlewares"))
86
+ else:
87
+ middlewares = list(entry_points.get("uipath.middlewares", []))
88
+ except Exception:
89
+ middlewares = list(importlib.metadata.entry_points()) # type: ignore
90
+ middlewares = [
91
+ ep for ep in middlewares if ep.group == "uipath.middlewares"
92
+ ]
93
+
94
+ if middlewares:
95
+ logger.info(f"Found {len(middlewares)} middleware plugins")
96
+
97
+ for entry_point in middlewares:
98
+ try:
99
+ register_func = entry_point.load()
100
+ register_func()
101
+ logger.info(f"Loaded middleware plugin: {entry_point.name}")
102
+ except Exception as e:
103
+ logger.error(
104
+ f"Failed to load middleware plugin {entry_point.name}: {str(e)}",
105
+ exc_info=True,
106
+ )
107
+ else:
108
+ logger.info("No middleware plugins found")
109
+
110
+ except Exception as e:
111
+ logger.error(f"No middleware plugins loaded: {str(e)}")
112
+ finally:
113
+ cls._plugins_loaded = True
uipath/_config.py ADDED
@@ -0,0 +1,6 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class Config(BaseModel):
5
+ base_url: str
6
+ secret: str
@@ -0,0 +1,83 @@
1
+ from os import environ as env
2
+ from typing import Optional
3
+
4
+ from dotenv import load_dotenv
5
+
6
+ from ._utils.constants import ENV_JOB_ID, ENV_JOB_KEY, ENV_ROBOT_KEY
7
+
8
+ load_dotenv()
9
+
10
+
11
+ class ExecutionContext:
12
+ """Manages the execution context for UiPath automation processes.
13
+
14
+ The ExecutionContext class handles information about the current execution environment,
15
+ including the job instance ID and robot key. This information is essential for
16
+ tracking and managing automation jobs in UiPath Automation Cloud.
17
+ """
18
+
19
+ def __init__(self) -> None:
20
+ try:
21
+ self._instance_key: Optional[str] = env[ENV_JOB_KEY]
22
+ except KeyError:
23
+ self._instance_key = None
24
+
25
+ try:
26
+ self._instance_id: Optional[str] = env[ENV_JOB_ID]
27
+ except KeyError:
28
+ self._instance_id = None
29
+
30
+ try:
31
+ self._robot_key: Optional[str] = env[ENV_ROBOT_KEY]
32
+ except KeyError:
33
+ self._robot_key = None
34
+
35
+ super().__init__()
36
+
37
+ @property
38
+ def instance_id(self) -> Optional[str]:
39
+ """Get the current job instance ID.
40
+
41
+ The instance ID uniquely identifies the current automation job execution
42
+ in UiPath Automation Cloud.
43
+
44
+ Returns:
45
+ Optional[str]: The job instance ID.
46
+
47
+ Raises:
48
+ ValueError: If the instance ID is not set in the environment.
49
+ """
50
+ if self._instance_id is None:
51
+ raise ValueError(f"Instance ID is not set ({ENV_JOB_ID})")
52
+
53
+ return self._instance_id
54
+
55
+ @property
56
+ def instance_key(self) -> Optional[str]:
57
+ """Get the current job instance key.
58
+
59
+ The instance key uniquely identifies the current automation job execution
60
+ in UiPath Automation Cloud.
61
+ """
62
+ if self._instance_key is None:
63
+ raise ValueError(f"Instance key is not set ({ENV_JOB_KEY})")
64
+
65
+ return self._instance_key
66
+
67
+ @property
68
+ def robot_key(self) -> Optional[str]:
69
+ """Get the current robot key.
70
+
71
+ The robot key identifies the UiPath Robot that is executing the current
72
+ automation job.
73
+
74
+ Returns:
75
+ Optional[str]: The robot key.
76
+
77
+ Raises:
78
+ ValueError: If the robot key is not set in the environment.
79
+ """
80
+ if self._robot_key is None:
81
+ raise ValueError(f"Robot key is not set ({ENV_ROBOT_KEY})")
82
+
83
+ return self._robot_key
@@ -0,0 +1,62 @@
1
+ from os import environ as env
2
+ from typing import Any, Optional
3
+
4
+ from dotenv import load_dotenv
5
+
6
+ from ._utils.constants import (
7
+ ENV_FOLDER_KEY,
8
+ ENV_FOLDER_PATH,
9
+ HEADER_FOLDER_KEY,
10
+ HEADER_FOLDER_PATH,
11
+ )
12
+
13
+ load_dotenv()
14
+
15
+
16
+ class FolderContext:
17
+ """Manages the folder context for UiPath automation resources.
18
+
19
+ The FolderContext class handles information about the current folder in which
20
+ automation resources (like processes, assets, etc.) are being accessed or modified.
21
+ This is essential for organizing and managing resources in the UiPath Automation Cloud
22
+ folder structure.
23
+ """
24
+
25
+ def __init__(self, **kwargs: Any) -> None:
26
+ try:
27
+ self._folder_key: Optional[str] = env[ENV_FOLDER_KEY]
28
+ except KeyError:
29
+ self._folder_key = None
30
+
31
+ try:
32
+ self._folder_path: Optional[str] = env[ENV_FOLDER_PATH]
33
+ except KeyError:
34
+ self._folder_path = None
35
+
36
+ super().__init__(**kwargs)
37
+
38
+ @property
39
+ def folder_headers(self) -> dict[str, str]:
40
+ """Get the HTTP headers for folder-based API requests.
41
+
42
+ Returns headers containing either the folder key or folder path,
43
+ which are used to specify the target folder for API operations.
44
+ The folder context is essential for operations that need to be
45
+ performed within a specific folder in UiPath Automation Cloud.
46
+
47
+ Returns:
48
+ dict[str, str]: A dictionary containing the appropriate folder
49
+ header (either folder key or folder path).
50
+
51
+ Raises:
52
+ ValueError: If neither folder key nor folder path is set in
53
+ the environment.
54
+ """
55
+ if self._folder_key is not None:
56
+ return {HEADER_FOLDER_KEY: self._folder_key}
57
+ elif self._folder_path is not None:
58
+ return {HEADER_FOLDER_PATH: self._folder_path}
59
+ else:
60
+ raise ValueError(
61
+ f"Folder key or path is not set ({ENV_FOLDER_KEY} or {ENV_FOLDER_PATH})"
62
+ )
@@ -0,0 +1,37 @@
1
+ from .action_schema import ActionSchema
2
+ from .actions import Action
3
+ from .assets import UserAsset
4
+ from .connections import Connection, ConnectionToken
5
+ from .context_grounding import ContextGroundingQueryResponse
6
+ from .exceptions import IngestionInProgressException
7
+ from .interrupt_models import CreateAction, InvokeProcess, WaitAction, WaitJob
8
+ from .job import Job
9
+ from .processes import Process
10
+ from .queues import (
11
+ CommitType,
12
+ QueueItem,
13
+ QueueItemPriority,
14
+ TransactionItem,
15
+ TransactionItemResult,
16
+ )
17
+
18
+ __all__ = [
19
+ "Action",
20
+ "UserAsset",
21
+ "ContextGroundingQueryResponse",
22
+ "Process",
23
+ "QueueItem",
24
+ "CommitType",
25
+ "TransactionItem",
26
+ "QueueItemPriority",
27
+ "TransactionItemResult",
28
+ "Connection",
29
+ "ConnectionToken",
30
+ "Job",
31
+ "InvokeProcess",
32
+ "ActionSchema",
33
+ "WaitJob",
34
+ "WaitAction",
35
+ "CreateAction",
36
+ "IngestionInProgressException",
37
+ ]
@@ -0,0 +1,26 @@
1
+ from datetime import datetime
2
+ from typing import List, Optional
3
+
4
+ from pydantic import BaseModel, ConfigDict, Field
5
+
6
+
7
+ class FieldDetails(BaseModel):
8
+ name: str
9
+ key: str
10
+
11
+
12
+ class ActionSchema(BaseModel):
13
+ model_config = ConfigDict(
14
+ validate_by_name=True,
15
+ validate_by_alias=True,
16
+ use_enum_values=True,
17
+ arbitrary_types_allowed=True,
18
+ extra="allow",
19
+ json_encoders={datetime: lambda v: v.isoformat() if v else None},
20
+ )
21
+
22
+ key: str
23
+ in_outs: Optional[List[FieldDetails]] = Field(default=None, alias="inOuts")
24
+ inputs: Optional[List[FieldDetails]] = None
25
+ outputs: Optional[List[FieldDetails]] = None
26
+ outcomes: Optional[List[FieldDetails]] = None
@@ -0,0 +1,64 @@
1
+ from datetime import datetime
2
+ from typing import Any, Dict, List, Optional, Union
3
+
4
+ from pydantic import BaseModel, ConfigDict, Field
5
+
6
+
7
+ class Action(BaseModel):
8
+ model_config = ConfigDict(
9
+ validate_by_name=True,
10
+ validate_by_alias=True,
11
+ use_enum_values=True,
12
+ arbitrary_types_allowed=True,
13
+ extra="allow",
14
+ json_encoders={datetime: lambda v: v.isoformat() if v else None},
15
+ )
16
+
17
+ task_definition_properties_id: Optional[int] = Field(
18
+ default=None, alias="taskDefinitionPropertiesId"
19
+ )
20
+ app_tasks_metadata: Optional[Any] = Field(default=None, alias="appTasksMetadata")
21
+ action_label: Optional[str] = Field(default=None, alias="actionLabel")
22
+ status: Optional[Union[str, int]] = None
23
+ data: Optional[Dict[str, Any]] = None
24
+ action: Optional[str] = None
25
+ wait_job_state: Optional[str] = Field(default=None, alias="waitJobState")
26
+ organization_unit_fully_qualified_name: Optional[str] = Field(
27
+ default=None, alias="organizationUnitFullyQualifiedName"
28
+ )
29
+ tags: Optional[List[Any]] = None
30
+ assigned_to_user: Optional[Any] = Field(default=None, alias="assignedToUser")
31
+ task_sla_details: Optional[List[Any]] = Field(default=None, alias="taskSlaDetails")
32
+ completed_by_user: Optional[Any] = Field(default=None, alias="completedByUser")
33
+ task_assignment_criteria: Optional[str] = Field(
34
+ default=None, alias="taskAssignmentCriteria"
35
+ )
36
+ task_assignees: Optional[List[Any]] = Field(default=None, alias="taskAssignees")
37
+ title: Optional[str] = None
38
+ type: Optional[str] = None
39
+ priority: Optional[str] = None
40
+ assigned_to_user_id: Optional[int] = Field(default=None, alias="assignedToUserId")
41
+ organization_unit_id: Optional[int] = Field(
42
+ default=None, alias="organizationUnitId"
43
+ )
44
+ external_tag: Optional[str] = Field(default=None, alias="externalTag")
45
+ creator_job_key: Optional[str] = Field(default=None, alias="creatorJobKey")
46
+ wait_job_key: Optional[str] = Field(default=None, alias="waitJobKey")
47
+ last_assigned_time: Optional[datetime] = Field(
48
+ default=None, alias="lastAssignedTime"
49
+ )
50
+ completion_time: Optional[datetime] = Field(default=None, alias="completionTime")
51
+ parent_operation_id: Optional[str] = Field(default=None, alias="parentOperationId")
52
+ key: Optional[str] = None
53
+ is_deleted: bool = Field(default=False, alias="isDeleted")
54
+ deleter_user_id: Optional[int] = Field(default=None, alias="deleterUserId")
55
+ deletion_time: Optional[datetime] = Field(default=None, alias="deletionTime")
56
+ last_modification_time: Optional[datetime] = Field(
57
+ default=None, alias="lastModificationTime"
58
+ )
59
+ last_modifier_user_id: Optional[int] = Field(
60
+ default=None, alias="lastModifierUserId"
61
+ )
62
+ creation_time: Optional[datetime] = Field(default=None, alias="creationTime")
63
+ creator_user_id: Optional[int] = Field(default=None, alias="creatorUserId")
64
+ id: Optional[int] = None
@@ -0,0 +1,48 @@
1
+ from datetime import datetime
2
+ from typing import Dict, List, Optional
3
+
4
+ from pydantic import BaseModel, ConfigDict, Field
5
+
6
+
7
+ class CredentialsConnectionData(BaseModel):
8
+ model_config = ConfigDict(
9
+ validate_by_name=True,
10
+ validate_by_alias=True,
11
+ use_enum_values=True,
12
+ arbitrary_types_allowed=True,
13
+ extra="allow",
14
+ json_encoders={datetime: lambda v: v.isoformat() if v else None},
15
+ )
16
+
17
+ url: str
18
+ body: str
19
+ bearer_token: str = Field(alias="bearerToken")
20
+
21
+
22
+ class UserAsset(BaseModel):
23
+ model_config = ConfigDict(
24
+ validate_by_name=True,
25
+ validate_by_alias=True,
26
+ use_enum_values=True,
27
+ arbitrary_types_allowed=True,
28
+ extra="allow",
29
+ json_encoders={datetime: lambda v: v.isoformat() if v else None},
30
+ )
31
+
32
+ name: Optional[str] = Field(default=None, alias="Name")
33
+ value: Optional[str] = Field(default=None, alias="Value")
34
+ value_type: Optional[str] = Field(default=None, alias="ValueType")
35
+ string_value: Optional[str] = Field(default=None, alias="StringValue")
36
+ bool_value: Optional[bool] = Field(default=None, alias="BoolValue")
37
+ int_value: Optional[int] = Field(default=None, alias="IntValue")
38
+ credential_username: Optional[str] = Field(default=None, alias="CredentialUsername")
39
+ credential_password: Optional[str] = Field(default=None, alias="CredentialPassword")
40
+ external_name: Optional[str] = Field(default=None, alias="ExternalName")
41
+ credential_store_id: Optional[int] = Field(default=None, alias="CredentialStoreId")
42
+ key_value_list: Optional[List[Dict[str, str]]] = Field(
43
+ default=None, alias="KeyValueList"
44
+ )
45
+ connection_data: Optional[CredentialsConnectionData] = Field(
46
+ default=None, alias="ConnectionData"
47
+ )
48
+ id: Optional[int] = Field(default=None, alias="Id")
@@ -0,0 +1,51 @@
1
+ from datetime import datetime
2
+ from typing import Any, Optional
3
+
4
+ from pydantic import BaseModel, ConfigDict, Field
5
+
6
+
7
+ class Connection(BaseModel):
8
+ model_config = ConfigDict(
9
+ validate_by_name=True,
10
+ validate_by_alias=True,
11
+ use_enum_values=True,
12
+ arbitrary_types_allowed=True,
13
+ extra="allow",
14
+ json_encoders={datetime: lambda v: v.isoformat() if v else None},
15
+ )
16
+
17
+ id: Optional[str] = None
18
+ name: Optional[str] = None
19
+ owner: Optional[str] = None
20
+ create_time: Optional[str] = Field(default=None, alias="createTime")
21
+ update_time: Optional[str] = Field(default=None, alias="updateTime")
22
+ state: Optional[str] = None
23
+ api_base_uri: Optional[str] = Field(default=None, alias="apiBaseUri")
24
+ element_instance_id: int = Field(alias="elementInstanceId")
25
+ connector: Optional[Any] = None
26
+ is_default: Optional[bool] = Field(default=None, alias="isDefault")
27
+ last_used_time: Optional[str] = Field(default=None, alias="lastUsedTime")
28
+ connection_identity: Optional[str] = Field(default=None, alias="connectionIdentity")
29
+ polling_interval_in_minutes: Optional[int] = Field(
30
+ default=None, alias="pollingIntervalInMinutes"
31
+ )
32
+ folder: Optional[Any] = None
33
+ element_version: Optional[str] = Field(default=None, alias="elementVersion")
34
+
35
+
36
+ class ConnectionToken(BaseModel):
37
+ model_config = ConfigDict(
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
40
+ use_enum_values=True,
41
+ arbitrary_types_allowed=True,
42
+ extra="allow",
43
+ json_encoders={datetime: lambda v: v.isoformat() if v else None},
44
+ )
45
+
46
+ access_token: str = Field(alias="accessToken")
47
+ token_type: Optional[str] = Field(default=None, alias="tokenType")
48
+ scope: Optional[str] = None
49
+ expires_in: Optional[int] = Field(default=None, alias="expiresIn")
50
+ api_base_uri: Optional[str] = Field(default=None, alias="apiBaseUri")
51
+ element_instance_id: Optional[int] = Field(default=None, alias="elementInstanceId")
@@ -0,0 +1,18 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class ContextGroundingMetadata(BaseModel):
5
+ operation_id: str
6
+ strategy: str
7
+
8
+
9
+ class ContextGroundingQueryResponse(BaseModel):
10
+ id: str
11
+ reference: str
12
+ source: str
13
+ page_number: str
14
+ source_document_id: str
15
+ caption: str
16
+ score: float
17
+ content: str
18
+ metadata: ContextGroundingMetadata