Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/uipath-platform/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[project]
name = "uipath-platform"
version = "0.0.14"
version = "0.0.15"
description = "HTTP client library for programmatic access to UiPath Platform"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
dependencies = [
"httpx>=0.28.1",
"tenacity>=9.0.0",
"truststore>=0.10.1",
"uipath-core>=0.5.3, <0.6.0",
"uipath-core>=0.5.4, <0.6.0",
"pydantic-function-models>=0.1.11",
]
classifiers = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
from .interrupt_models import (
CreateBatchTransform,
CreateDeepRag,
CreateDeepRagRaw,
CreateEphemeralIndex,
CreateEphemeralIndexRaw,
CreateEscalation,
CreateTask,
DocumentExtraction,
Expand All @@ -39,9 +41,11 @@
InvokeSystemAgent,
WaitBatchTransform,
WaitDeepRag,
WaitDeepRagRaw,
WaitDocumentExtraction,
WaitDocumentExtractionValidation,
WaitEphemeralIndex,
WaitEphemeralIndexRaw,
WaitEscalation,
WaitJob,
WaitJobRaw,
Expand Down Expand Up @@ -69,15 +73,19 @@
"WaitJobRaw",
"PagedResult",
"CreateDeepRag",
"CreateDeepRagRaw",
"WaitDeepRag",
"WaitDeepRagRaw",
"CreateBatchTransform",
"WaitBatchTransform",
"DocumentExtraction",
"WaitDocumentExtraction",
"InvokeSystemAgent",
"WaitSystemAgent",
"CreateEphemeralIndex",
"CreateEphemeralIndexRaw",
"WaitEphemeralIndex",
"WaitEphemeralIndexRaw",
"DocumentExtractionValidation",
"WaitDocumentExtractionValidation",
"RequestSpec",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ def validate_ephemeral_index_requires_index_id(self) -> "CreateDeepRag":
return self


class CreateDeepRagRaw(CreateDeepRag):
"""Model representing a Deep RAG task creation (returns the deep_rag without status validation)."""

pass


class WaitDeepRag(BaseModel):
"""Model representing a wait Deep RAG task."""

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


class WaitDeepRagRaw(WaitDeepRag):
"""Model representing a wait Deep RAG task (returns the deep_rag without status validation)."""

pass


class CreateEphemeralIndex(BaseModel):
"""Model representing a Ephemeral Index task creation."""
"""Model representing an Ephemeral Index task creation."""

usage: EphemeralIndexUsage
attachments: list[str]


class CreateEphemeralIndexRaw(CreateEphemeralIndex):
"""Model representing an Ephemeral Index task creation (returns the ephemeral index without status validation)."""

pass


class WaitEphemeralIndex(BaseModel):
"""Model representing a wait Ephemeral Index task."""

index: ContextGroundingIndex


class WaitEphemeralIndexRaw(WaitEphemeralIndex):
"""Model representing a wait Ephemeral Index task (returns the ephemeral index without status validation)."""

pass


class CreateBatchTransform(BaseModel):
"""Model representing a Batch Transform task creation."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@ def _deep_rag_retrieve_spec(
endpoint=Endpoint(f"/ecs_/v2/deeprag/{id}"),
params={
"$expand": "content",
"$select": "content,name,createdDate,lastDeepRagStatus",
"$select": "id,content,name,createdDate,lastDeepRagStatus,failureReason",
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ class DeepRagResponse(BaseModel):
arbitrary_types_allowed=True,
extra="allow",
)
id: str
name: str
created_date: str = Field(alias="createdDate")
last_deep_rag_status: DeepRagStatus = Field(alias="lastDeepRagStatus")
content: DeepRagContent | None = Field(alias="content")
failure_reason: str | None = Field(alias="failureReason")


class BatchTransformStatus(str, Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
from uipath.platform.common.interrupt_models import (
CreateBatchTransform,
CreateDeepRag,
CreateDeepRagRaw,
CreateEphemeralIndex,
CreateEphemeralIndexRaw,
CreateEscalation,
CreateTask,
DocumentExtraction,
Expand All @@ -35,9 +37,11 @@
InvokeSystemAgent,
WaitBatchTransform,
WaitDeepRag,
WaitDeepRagRaw,
WaitDocumentExtraction,
WaitDocumentExtractionValidation,
WaitEphemeralIndex,
WaitEphemeralIndexRaw,
WaitEscalation,
WaitJob,
WaitJobRaw,
Expand Down Expand Up @@ -246,6 +250,9 @@ async def read_trigger(self, trigger: UiPathResumeTrigger) -> Any | None:
f"DeepRag is not finished yet. Current status: {deep_rag_status}",
)

if trigger.trigger_name == UiPathResumeTriggerName.DEEP_RAG_RAW:
return deep_rag

if deep_rag_status != DeepRagStatus.SUCCESSFUL:
raise UiPathFaultedTriggerError(
ErrorCategory.USER,
Expand Down Expand Up @@ -285,6 +292,12 @@ async def read_trigger(self, trigger: UiPathResumeTrigger) -> Any | None:
f"Index ingestion is not finished yet. Current status: {ephemeral_index_status}",
)

if (
trigger.trigger_name
== UiPathResumeTriggerName.INDEX_INGESTION_RAW
):
return ephemeral_index

if ephemeral_index_status != IndexStatus.SUCCESSFUL:
raise UiPathFaultedTriggerError(
ErrorCategory.USER,
Expand Down Expand Up @@ -512,7 +525,9 @@ def _determine_trigger_type(self, value: Any) -> UiPathResumeTriggerType:
),
):
return UiPathResumeTriggerType.JOB
if isinstance(value, (CreateDeepRag, WaitDeepRag)):
if isinstance(
value, (CreateDeepRag, CreateDeepRagRaw, WaitDeepRag, WaitDeepRagRaw)
):
return UiPathResumeTriggerType.DEEP_RAG
if isinstance(value, (CreateEphemeralIndex, WaitEphemeralIndex)):
return UiPathResumeTriggerType.INDEX_INGESTION
Expand Down Expand Up @@ -546,8 +561,12 @@ def _determine_trigger_name(self, value: Any) -> UiPathResumeTriggerName:
value, (InvokeProcess, WaitJob, InvokeSystemAgent, WaitSystemAgent)
):
return UiPathResumeTriggerName.JOB
if isinstance(value, (CreateDeepRagRaw, WaitDeepRagRaw)):
return UiPathResumeTriggerName.DEEP_RAG_RAW
if isinstance(value, (CreateDeepRag, WaitDeepRag)):
return UiPathResumeTriggerName.DEEP_RAG
if isinstance(value, (CreateEphemeralIndexRaw, WaitEphemeralIndexRaw)):
return UiPathResumeTriggerName.INDEX_INGESTION_RAW
if isinstance(value, (CreateEphemeralIndex, WaitEphemeralIndex)):
return UiPathResumeTriggerName.INDEX_INGESTION
if isinstance(value, (CreateBatchTransform, WaitBatchTransform)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -987,16 +987,18 @@ def test_retrieve_deep_rag(
) -> None:
citation = Citation(ordinal=1, page_number=1, source="abc", reference="abc")
httpx_mock.add_response(
url=f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?$expand=content&$select=content,name,createdDate,lastDeepRagStatus",
url=f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?$expand=content&$select=id,content,name,createdDate,lastDeepRagStatus,failureReason",
status_code=200,
json={
"id": "test-task-id",
"name": "test-deep-rag-task",
"createdDate": "2024-01-15T10:30:00Z",
"lastDeepRagStatus": "Successful",
"content": {
"text": "This is the deep RAG response text.",
"citations": [citation.model_dump()],
},
"failureReason": None,
},
)

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

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

httpx_mock.add_response(
url=f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?$expand=content&$select=content,name,createdDate,lastDeepRagStatus",
url=f"{base_url}{org}{tenant}/ecs_/v2/deeprag/test-task-id?$expand=content&$select=id,content,name,createdDate,lastDeepRagStatus,failureReason",
status_code=200,
json={
"id": "test-task-id",
"name": "test-deep-rag-task",
"createdDate": "2024-01-15T10:30:00Z",
"lastDeepRagStatus": "Successful",
"content": {
"text": "This is the deep RAG response text.",
"citations": [citation.model_dump()],
},
"failureReason": None,
},
)

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

assert HEADER_USER_AGENT in sent_requests[0].headers
Expand Down
Loading
Loading