Skip to content

feat(context-grounding): support Semantic ephemeral indexes and search by index id - #1921

Open
mmotasim-uipath wants to merge 1 commit into
mainfrom
feat/context-grounding-semantic-ephemeral
Open

mmotasim-uipath wants to merge 1 commit into
mainfrom
feat/context-grounding-semantic-ephemeral

Conversation

@mmotasim-uipath

Copy link
Copy Markdown

Summary

Ephemeral (JIT) indexes can only be created for DeepRAG or BatchRAG through the SDK. The service also accepts usage: "Semantic", which gives a plain semantic-search index over the attached files, but the SDK has no way to create one or to search it afterwards.

  • EphemeralIndexUsage.SEMANTIC = "Semantic": create_ephemeral_index(usage=EphemeralIndexUsage.SEMANTIC, attachments=[...]) now works.
  • unified_search_by_id / unified_search_by_id_async: search an index by its id. unified_search resolves the index by name first, and ephemeral indexes have none. The new methods reuse _unified_search_spec and skip the name lookup. Callers poll retrieve_by_id until lastIngestionStatus is Successful, as the CLI help already tells them to for ephemeral indexes.
  • CLI: create-ephemeral --usage Semantic (PDF, TXT), and search --index-id <id> as an alternative to --index-name (mutually exclusive, like retrieve and deep-rag start).

The change is additive: no existing signature changes. uipath-platform goes to 0.2.34 and uipath to 2.14.28, with the platform pin raised to match.

Why

We use this for prior-auth chart reading: upload a patient's chart as a job attachment, build a Semantic ephemeral index over just that file, then fetch the whole chart with one search (threshold=0.0, large number_of_results). One index per document means other documents can't come back, which a shared bucket index can't guarantee. Until now this needed raw HTTP calls to /ecs_/v2/indexes/createephemeral and /ecs_/v1.2/search/{id}.

Testing

  • Unit tests: create with Semantic (request body), and unified_search_by_id sync + async (a single request, no name lookup, correct body and user agent). CLI tests for --usage Semantic, search --index-id, and the name/id validation. The SDK/CLI contract test exempts search --index-id the same way it already exempts retrieve --index-id.
  • ruff check, ruff format --check and mypy src tests are clean. uipath-platform context-grounding + HITL tests: 263 passed. uipath context-grounding CLI + contract tests: 74 passed.
  • Live against a Development tenant with this branch: create_ephemeral_index(SEMANTIC) on a one-page PDF went from InProgress to Successful in 24 s, and unified_search_by_id returned the page. With raw calls to the same endpoints, a 23-page scanned PDF took about 180 s to ingest and came back as one chunk per page.

Open question for Context Grounding owners

Is Semantic a supported, stable usage value for ephemeral indexes? It works in our tenant today, but it isn't documented. If it isn't meant to be public, say so and I'll close this.

🤖 Generated with Claude Code

…h by index id

Add EphemeralIndexUsage.SEMANTIC so an ephemeral index can be built from
attachments for plain semantic search, and unified_search_by_id(_async) to
search it: ephemeral indexes have no name, and unified_search looks the index
up by name first.

CLI: create-ephemeral accepts --usage Semantic (PDF, TXT); search accepts
--index-id as an alternative to --index-name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 23:26
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime test:uipath-integrations labels Sep 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The ID-search path silently ignores an accepted option, and bundled CLI and SDK references remain stale.

Review effort: Balanced
Findings: 1 Medium severity · 2 Low severity

Open (3)
What changed in this PR

Adds Semantic ephemeral indexes and direct index-ID search to Context Grounding.

Changes:

  • Adds EphemeralIndexUsage.SEMANTIC and sync/async ID-based search APIs.
  • Extends CLI creation/search commands with Semantic usage and --index-id.
  • Adds tests and bumps package versions.
File Description
packages/​uipath/​uv.lock Updates locked package versions.
packages/​uipath/​tests/​cli/​integration/​test_context_grounding_commands.py Tests Semantic creation and ID search.
packages/​uipath/​tests/​cli/​contract/​test_sdk_cli_alignment.py Exempts routed ID parameter.
packages/​uipath/​src/​uipath/​_cli/​services/​cli_context_grounding.py Extends Context Grounding CLI.
packages/​uipath/​pyproject.toml Bumps SDK and platform dependency versions.
packages/​uipath-platform/​uv.lock Updates the locked platform version.
packages/​uipath-platform/​tests/​services/​test_context_grounding_service.py Tests Semantic requests and ID searches.
packages/​uipath-platform/​src/​uipath/​platform/​context_grounding/​context_grounding.py Adds Semantic enum value.
packages/​uipath-platform/​src/​uipath/​platform/​context_grounding/​_context_grounding_service.py Implements direct ID-based search APIs.
packages/​uipath-platform/​pyproject.toml Bumps platform package version.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 515 to +517
client = ServiceCommandBase.get_client(ctx)
if index_id:
return client.context_grounding.unified_search_by_id(
Comment on lines +1932 to +1933
@traced(name="contextgrounding_unified_search_by_id", run_type="uipath")
def unified_search_by_id(
Comment on lines +450 to +452
@click.option("--index-name", help="Name of the index to search")
@click.option(
"--index-id", help="ID of the index to search (ephemeral Semantic indexes)"
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants