feat(context-grounding): add start_deep_rag_from_attachments primitive - #1872
Conversation
🚨 Heads up:
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new Context Grounding “single-call” Deep RAG primitive that creates an ephemeral index from attachments and starts the Deep RAG task in one server operation, and wires that flow into resume-trigger handling in uipath-platform.
Changes:
- Add
start_deep_rag_from_attachments(_async)toContextGroundingService, posting toPOST /ecs_/v2/deeprag/create. - Extend the
CreateDeepRaginterrupt model with optionalattachmentsand route resume-trigger creation through the new SDK method when provided. - Bump
uipath-platformto0.2.22and update lockfiles.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/uipath/uv.lock | Updates dependency lock and uipath-platform version reference. |
| packages/uipath-platform/uv.lock | Updates dependency lock for uipath-platform. |
| packages/uipath-platform/src/uipath/platform/resume_triggers/_protocol.py | Adds attachments-based dispatch to the new Deep RAG primitive. |
| packages/uipath-platform/src/uipath/platform/context_grounding/_context_grounding_service.py | Adds new Deep RAG-from-attachments request spec + public methods; adds deprecations. |
| packages/uipath-platform/src/uipath/platform/common/interrupt_models.py | Adds attachments to CreateDeepRag and relaxes validation for ephemeral Deep RAG creation. |
| packages/uipath-platform/pyproject.toml | Bumps package version to 0.2.22. |
Suppressed comments (1)
packages/uipath-platform/src/uipath/platform/context_grounding/_context_grounding_service.py:1407
- The PR description says existing start_deep_rag_ephemeral_async/start_deep_rag_async paths are “untouched”, but this change adds a
@deprecateddecorator which will emit warnings and is a behavior change for callers. Also, start_deep_rag_from_attachments_async is not a general replacement for start_deep_rag_ephemeral_async (it requires attachments and does not support glob_pattern). Either update the PR description to reflect this deprecation or reconsider the deprecation here / adjust the deprecation message to describe the narrower replacement scope.
@deprecated(
"Use start_deep_rag_from_attachments_async instead — one call, no separate index step."
)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "Use start_deep_rag_from_attachments instead — one call, no separate index step." | ||
| ) | ||
| @resource_override(resource_type="index", resource_identifier="index_name") | ||
| @traced(name="contextgrounding_start_deep_rag", run_type="uipath") | ||
| async def start_deep_rag_ephemeral( |
| folder_path=folder_path, | ||
| ) | ||
|
|
||
| response = self.request( |
There was a problem hiding this comment.
what do we return if attachment isn't found? 404? should we catch that and return user readable message?
There was a problem hiding this comment.
the workflow just fails - maybe we validate attachment exist before we accept the request
There was a problem hiding this comment.
Today the create endpoint returns 201 without touching Orchestrator — a bad attachment id only surfaces later as a Failed DeepRag status.
Fixing server-side in a follow-up vdbs PR: OrchestratorClient.GetAttachmentByIdAsync will translate the downstream 404 into RecordNotFoundException with a localized Attachment_NotFound message (mirrors the SystemIndexesService.cs:82-85 pattern), and CreateDeepRagFromAttachmentsAsync will resolve the attachments up front so the failure is synchronous. That reaches the SDK as a real 404, which BaseService.request already wraps in EnrichedException (with the localized message pulled by error_info) — so no SDK change needed here.
Adds a single-call primitive that creates the ephemeral index and
starts the Deep RAG task in one server operation. Callers no longer
need to create the index separately and wait for ingestion before
starting the task.
- New SDK methods start_deep_rag_from_attachments(_async) on
ContextGroundingService, hitting POST /ecs_/v2/deeprag/create.
- CreateDeepRag interrupt model gains an optional attachments field;
the ephemeral-index validator now accepts attachments as an
alternative to index_id.
- UiPathResumeTriggerCreator dispatches to the new SDK method when
CreateDeepRag.attachments is set; existing paths untouched.
- New feature flag constant DEEP_RAG_FROM_ATTACHMENTS_FEATURE_FLAG
("EnableDeepRagFromAttachments") registered in the shared registry
so downstream callers can gate the switch.
The single caller can migrate in one step; a flag would only add code to remove later. Backend rollback path is unchanged either way.
mypy resolved `list[str]` in the class body to the sibling `ContextGroundingService.list` method (a Function). Switched to `List[str]` to match the file's convention. Bumped uipath-platform 0.2.20 -> 0.2.22 (0.2.21 already on PyPI).
Superseded by start_deep_rag_from_attachments{,_async}, which does
index creation and task start in one server call. The existing
methods keep working (the dispatcher still routes to them for the
is_ephemeral_index=True + index_id path); callers should migrate
to the new attachments-based primitive.
- CreateDeepRag validator now rejects empty attachments and forbids
combining attachments with index_id/index_name.
- Dispatcher branch changed to explicit `is not None` for parity
with the validator's semantics.
- New SDK tests exercise start_deep_rag_from_attachments{,_async}:
URL, payload shape, User-Agent, default citation_mode=INLINE.
- New HITL tests cover the attachments dispatch path and the two
new validator errors.
The spec builder called _resolve_folder_key(None, None) and then header_folder(None, None) unconditionally, which sent a header the test mocks did not include and left the mock URL unrequested. Match the ephemeral spec's pattern: only add the folder header when the caller actually passes folder_key or folder_path.
- test_start_deep_rag_from_attachments_with_folder_key exercises the spec's folder branch, verifying the header ships with the request. - test_create_deep_rag_attachments_rejects_index_name covers the index_name half of the mutual-exclusivity OR that the existing index_id test only touched.
7591636 to
d9f6daf
Compare
|



What
Adds a single-call primitive that creates the ephemeral index and starts the Deep RAG task in one server operation. Callers no longer need to create the index separately and wait for ingestion before starting the task.
Changes
start_deep_rag_from_attachments(_async)onContextGroundingService, hittingPOST /ecs_/v2/deeprag/create(vdbsDeepRagController.CreateAsync— the collection-levelCreateaction registered in the OData model).CreateDeepRaginterrupt model gains an optionalattachments: list[str] | Nonefield; the ephemeral-index validator now acceptsattachmentsas an alternative toindex_id.UiPathResumeTriggerCreatordispatches to the new SDK method whenCreateDeepRag.attachmentsis set; the existingstart_deep_rag_ephemeral_async/start_deep_rag_asyncpaths are untouched.Why
The two-step flow (create ephemeral index → wait for ingestion → create Deep RAG task) collapses into one server call. On the client side that removes the middle
WaitEphemeralIndexinterrupt — the trailing wait for task completion remains.Notes
The endpoint URL is
POST /ecs_/v2/deeprag/createbased on vdbs' OData config (EnableUnqualifiedOperationCall = true+ the collection actionCreateinODataModelConfiguration.cs:60). Worth a smoke test against a running vdbs before merge to confirm the route resolves.