Skip to content

Commit 5022b26

Browse files
feat: add index_ingestion_raw and deep_rag_raw triggers (#1412)
1 parent 3bba7a0 commit 5022b26

File tree

9 files changed

+452
-11
lines changed

9 files changed

+452
-11
lines changed

packages/uipath-platform/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[project]
22
name = "uipath-platform"
3-
version = "0.0.14"
3+
version = "0.0.15"
44
description = "HTTP client library for programmatic access to UiPath Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"
77
dependencies = [
88
"httpx>=0.28.1",
99
"tenacity>=9.0.0",
1010
"truststore>=0.10.1",
11-
"uipath-core>=0.5.3, <0.6.0",
11+
"uipath-core>=0.5.4, <0.6.0",
1212
"pydantic-function-models>=0.1.11",
1313
]
1414
classifiers = [

packages/uipath-platform/src/uipath/platform/common/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
from .interrupt_models import (
3030
CreateBatchTransform,
3131
CreateDeepRag,
32+
CreateDeepRagRaw,
3233
CreateEphemeralIndex,
34+
CreateEphemeralIndexRaw,
3335
CreateEscalation,
3436
CreateTask,
3537
DocumentExtraction,
@@ -39,9 +41,11 @@
3941
InvokeSystemAgent,
4042
WaitBatchTransform,
4143
WaitDeepRag,
44+
WaitDeepRagRaw,
4245
WaitDocumentExtraction,
4346
WaitDocumentExtractionValidation,
4447
WaitEphemeralIndex,
48+
WaitEphemeralIndexRaw,
4549
WaitEscalation,
4650
WaitJob,
4751
WaitJobRaw,
@@ -69,15 +73,19 @@
6973
"WaitJobRaw",
7074
"PagedResult",
7175
"CreateDeepRag",
76+
"CreateDeepRagRaw",
7277
"WaitDeepRag",
78+
"WaitDeepRagRaw",
7379
"CreateBatchTransform",
7480
"WaitBatchTransform",
7581
"DocumentExtraction",
7682
"WaitDocumentExtraction",
7783
"InvokeSystemAgent",
7884
"WaitSystemAgent",
7985
"CreateEphemeralIndex",
86+
"CreateEphemeralIndexRaw",
8087
"WaitEphemeralIndex",
88+
"WaitEphemeralIndexRaw",
8189
"DocumentExtractionValidation",
8290
"WaitDocumentExtractionValidation",
8391
"RequestSpec",

packages/uipath-platform/src/uipath/platform/common/interrupt_models.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ def validate_ephemeral_index_requires_index_id(self) -> "CreateDeepRag":
118118
return self
119119

120120

121+
class CreateDeepRagRaw(CreateDeepRag):
122+
"""Model representing a Deep RAG task creation (returns the deep_rag without status validation)."""
123+
124+
pass
125+
126+
121127
class WaitDeepRag(BaseModel):
122128
"""Model representing a wait Deep RAG task."""
123129

@@ -126,19 +132,37 @@ class WaitDeepRag(BaseModel):
126132
index_folder_key: str | None = None
127133

128134

135+
class WaitDeepRagRaw(WaitDeepRag):
136+
"""Model representing a wait Deep RAG task (returns the deep_rag without status validation)."""
137+
138+
pass
139+
140+
129141
class CreateEphemeralIndex(BaseModel):
130-
"""Model representing a Ephemeral Index task creation."""
142+
"""Model representing an Ephemeral Index task creation."""
131143

132144
usage: EphemeralIndexUsage
133145
attachments: list[str]
134146

135147

148+
class CreateEphemeralIndexRaw(CreateEphemeralIndex):
149+
"""Model representing an Ephemeral Index task creation (returns the ephemeral index without status validation)."""
150+
151+
pass
152+
153+
136154
class WaitEphemeralIndex(BaseModel):
137155
"""Model representing a wait Ephemeral Index task."""
138156

139157
index: ContextGroundingIndex
140158

141159

160+
class WaitEphemeralIndexRaw(WaitEphemeralIndex):
161+
"""Model representing a wait Ephemeral Index task (returns the ephemeral index without status validation)."""
162+
163+
pass
164+
165+
142166
class CreateBatchTransform(BaseModel):
143167
"""Model representing a Batch Transform task creation."""
144168

packages/uipath-platform/src/uipath/platform/context_grounding/_context_grounding_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ def _deep_rag_retrieve_spec(
18081808
endpoint=Endpoint(f"/ecs_/v2/deeprag/{id}"),
18091809
params={
18101810
"$expand": "content",
1811-
"$select": "content,name,createdDate,lastDeepRagStatus",
1811+
"$select": "id,content,name,createdDate,lastDeepRagStatus,failureReason",
18121812
},
18131813
)
18141814

packages/uipath-platform/src/uipath/platform/context_grounding/context_grounding.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ class DeepRagResponse(BaseModel):
9999
arbitrary_types_allowed=True,
100100
extra="allow",
101101
)
102+
id: str
102103
name: str
103104
created_date: str = Field(alias="createdDate")
104105
last_deep_rag_status: DeepRagStatus = Field(alias="lastDeepRagStatus")
105106
content: DeepRagContent | None = Field(alias="content")
107+
failure_reason: str | None = Field(alias="failureReason")
106108

107109

108110
class BatchTransformStatus(str, Enum):

packages/uipath-platform/src/uipath/platform/resume_triggers/_protocol.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
from uipath.platform.common.interrupt_models import (
2626
CreateBatchTransform,
2727
CreateDeepRag,
28+
CreateDeepRagRaw,
2829
CreateEphemeralIndex,
30+
CreateEphemeralIndexRaw,
2931
CreateEscalation,
3032
CreateTask,
3133
DocumentExtraction,
@@ -35,9 +37,11 @@
3537
InvokeSystemAgent,
3638
WaitBatchTransform,
3739
WaitDeepRag,
40+
WaitDeepRagRaw,
3841
WaitDocumentExtraction,
3942
WaitDocumentExtractionValidation,
4043
WaitEphemeralIndex,
44+
WaitEphemeralIndexRaw,
4145
WaitEscalation,
4246
WaitJob,
4347
WaitJobRaw,
@@ -246,6 +250,9 @@ async def read_trigger(self, trigger: UiPathResumeTrigger) -> Any | None:
246250
f"DeepRag is not finished yet. Current status: {deep_rag_status}",
247251
)
248252

253+
if trigger.trigger_name == UiPathResumeTriggerName.DEEP_RAG_RAW:
254+
return deep_rag
255+
249256
if deep_rag_status != DeepRagStatus.SUCCESSFUL:
250257
raise UiPathFaultedTriggerError(
251258
ErrorCategory.USER,
@@ -285,6 +292,12 @@ async def read_trigger(self, trigger: UiPathResumeTrigger) -> Any | None:
285292
f"Index ingestion is not finished yet. Current status: {ephemeral_index_status}",
286293
)
287294

295+
if (
296+
trigger.trigger_name
297+
== UiPathResumeTriggerName.INDEX_INGESTION_RAW
298+
):
299+
return ephemeral_index
300+
288301
if ephemeral_index_status != IndexStatus.SUCCESSFUL:
289302
raise UiPathFaultedTriggerError(
290303
ErrorCategory.USER,
@@ -512,7 +525,9 @@ def _determine_trigger_type(self, value: Any) -> UiPathResumeTriggerType:
512525
),
513526
):
514527
return UiPathResumeTriggerType.JOB
515-
if isinstance(value, (CreateDeepRag, WaitDeepRag)):
528+
if isinstance(
529+
value, (CreateDeepRag, CreateDeepRagRaw, WaitDeepRag, WaitDeepRagRaw)
530+
):
516531
return UiPathResumeTriggerType.DEEP_RAG
517532
if isinstance(value, (CreateEphemeralIndex, WaitEphemeralIndex)):
518533
return UiPathResumeTriggerType.INDEX_INGESTION
@@ -546,8 +561,12 @@ def _determine_trigger_name(self, value: Any) -> UiPathResumeTriggerName:
546561
value, (InvokeProcess, WaitJob, InvokeSystemAgent, WaitSystemAgent)
547562
):
548563
return UiPathResumeTriggerName.JOB
564+
if isinstance(value, (CreateDeepRagRaw, WaitDeepRagRaw)):
565+
return UiPathResumeTriggerName.DEEP_RAG_RAW
549566
if isinstance(value, (CreateDeepRag, WaitDeepRag)):
550567
return UiPathResumeTriggerName.DEEP_RAG
568+
if isinstance(value, (CreateEphemeralIndexRaw, WaitEphemeralIndexRaw)):
569+
return UiPathResumeTriggerName.INDEX_INGESTION_RAW
551570
if isinstance(value, (CreateEphemeralIndex, WaitEphemeralIndex)):
552571
return UiPathResumeTriggerName.INDEX_INGESTION
553572
if isinstance(value, (CreateBatchTransform, WaitBatchTransform)):

packages/uipath-platform/tests/services/test_context_grounding_service.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -987,16 +987,18 @@ def test_retrieve_deep_rag(
987987
) -> None:
988988
citation = Citation(ordinal=1, page_number=1, source="abc", reference="abc")
989989
httpx_mock.add_response(
990-
url=f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?$expand=content&$select=content,name,createdDate,lastDeepRagStatus",
990+
url=f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?$expand=content&$select=id,content,name,createdDate,lastDeepRagStatus,failureReason",
991991
status_code=200,
992992
json={
993+
"id": "test-task-id",
993994
"name": "test-deep-rag-task",
994995
"createdDate": "2024-01-15T10:30:00Z",
995996
"lastDeepRagStatus": "Successful",
996997
"content": {
997998
"text": "This is the deep RAG response text.",
998999
"citations": [citation.model_dump()],
9991000
},
1001+
"failureReason": None,
10001002
},
10011003
)
10021004

@@ -1017,7 +1019,7 @@ def test_retrieve_deep_rag(
10171019
assert sent_requests[0].method == "GET"
10181020
assert (
10191021
sent_requests[0].url
1020-
== f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?%24expand=content&%24select=content%2Cname%2CcreatedDate%2ClastDeepRagStatus"
1022+
== f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?%24expand=content&%24select=id%2Ccontent%2Cname%2CcreatedDate%2ClastDeepRagStatus%2CfailureReason"
10211023
)
10221024

10231025
assert HEADER_USER_AGENT in sent_requests[0].headers
@@ -1039,16 +1041,18 @@ async def test_retrieve_deep_rag_async(
10391041
citation = Citation(ordinal=1, page_number=1, source="abc", reference="abc")
10401042

10411043
httpx_mock.add_response(
1042-
url=f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?$expand=content&$select=content,name,createdDate,lastDeepRagStatus",
1044+
url=f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?$expand=content&$select=id,content,name,createdDate,lastDeepRagStatus,failureReason",
10431045
status_code=200,
10441046
json={
1047+
"id": "test-task-id",
10451048
"name": "test-deep-rag-task",
10461049
"createdDate": "2024-01-15T10:30:00Z",
10471050
"lastDeepRagStatus": "Successful",
10481051
"content": {
10491052
"text": "This is the deep RAG response text.",
10501053
"citations": [citation.model_dump()],
10511054
},
1055+
"failureReason": None,
10521056
},
10531057
)
10541058

@@ -1069,7 +1073,7 @@ async def test_retrieve_deep_rag_async(
10691073
assert sent_requests[0].method == "GET"
10701074
assert (
10711075
sent_requests[0].url
1072-
== f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?%24expand=content&%24select=content%2Cname%2CcreatedDate%2ClastDeepRagStatus"
1076+
== f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?%24expand=content&%24select=id%2Ccontent%2Cname%2CcreatedDate%2ClastDeepRagStatus%2CfailureReason"
10731077
)
10741078

10751079
assert HEADER_USER_AGENT in sent_requests[0].headers

0 commit comments

Comments
 (0)