Skip to content

Commit bbfb170

Browse files
pateljay43claude
andcommitted
feat(context-grounding): overhaul CLI with named options and ephemeral support
Rewrites the context-grounding CLI with explicit named options, ephemeral index support, and full command coverage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 22b52cf commit bbfb170

8 files changed

Lines changed: 1415 additions & 794 deletions

File tree

packages/uipath-platform/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-platform"
3-
version = "0.1.15"
3+
version = "0.1.16"
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"

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

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,6 +1690,184 @@ async def delete_index_async(
16901690
headers=spec.headers,
16911691
)
16921692

1693+
@resource_override(resource_type="index")
1694+
@traced(name="contextgrounding_list", run_type="uipath")
1695+
def list_indexes(
1696+
self,
1697+
folder_key: Optional[str] = None,
1698+
folder_path: Optional[str] = None,
1699+
) -> List[ContextGroundingIndex]:
1700+
"""List all context grounding indexes in a folder.
1701+
1702+
If no folder_key or folder_path is provided and no folder context is
1703+
configured, falls back to listing across all folders.
1704+
1705+
Args:
1706+
folder_key (Optional[str]): The key of the folder to list indexes from.
1707+
folder_path (Optional[str]): The path of the folder to list indexes from.
1708+
1709+
Returns:
1710+
List[ContextGroundingIndex]: A list of all indexes in the folder.
1711+
"""
1712+
resolved_folder_key = self._resolve_folder_key(folder_key, folder_path)
1713+
if not resolved_folder_key:
1714+
return self.retrieve_across_folders()
1715+
1716+
spec = self._list_spec(folder_key=resolved_folder_key)
1717+
1718+
response = self.request(
1719+
spec.method,
1720+
spec.endpoint,
1721+
params=spec.params,
1722+
headers=spec.headers,
1723+
).json()
1724+
1725+
return [
1726+
ContextGroundingIndex.model_validate(item) for item in response["value"]
1727+
]
1728+
1729+
@resource_override(resource_type="index")
1730+
@traced(name="contextgrounding_list", run_type="uipath")
1731+
async def list_indexes_async(
1732+
self,
1733+
folder_key: Optional[str] = None,
1734+
folder_path: Optional[str] = None,
1735+
) -> List[ContextGroundingIndex]:
1736+
"""Asynchronously list all context grounding indexes in a folder.
1737+
1738+
If no folder_key or folder_path is provided and no folder context is
1739+
configured, falls back to listing across all folders.
1740+
1741+
Args:
1742+
folder_key (Optional[str]): The key of the folder to list indexes from.
1743+
folder_path (Optional[str]): The path of the folder to list indexes from.
1744+
1745+
Returns:
1746+
List[ContextGroundingIndex]: A list of all indexes in the folder.
1747+
"""
1748+
resolved_folder_key = self._resolve_folder_key(folder_key, folder_path)
1749+
if not resolved_folder_key:
1750+
return await self.retrieve_across_folders_async()
1751+
1752+
spec = self._list_spec(folder_key=resolved_folder_key)
1753+
1754+
response = (
1755+
await self.request_async(
1756+
spec.method,
1757+
spec.endpoint,
1758+
params=spec.params,
1759+
headers=spec.headers,
1760+
)
1761+
).json()
1762+
1763+
return [
1764+
ContextGroundingIndex.model_validate(item) for item in response["value"]
1765+
]
1766+
1767+
@resource_override(resource_type="index")
1768+
@traced(name="contextgrounding_delete_by_name", run_type="uipath")
1769+
def delete_by_name(
1770+
self,
1771+
name: str,
1772+
folder_key: Optional[str] = None,
1773+
folder_path: Optional[str] = None,
1774+
) -> None:
1775+
"""Delete a context grounding index by its name.
1776+
1777+
This method retrieves the index by name and then deletes it.
1778+
1779+
Args:
1780+
name (str): The name of the context index to delete.
1781+
folder_key (Optional[str]): The key of the folder where the index resides.
1782+
folder_path (Optional[str]): The path of the folder where the index resides.
1783+
1784+
Raises:
1785+
Exception: If no index with the given name is found.
1786+
"""
1787+
index = self.retrieve(name, folder_key=folder_key, folder_path=folder_path)
1788+
self.delete_index(index, folder_key=folder_key, folder_path=folder_path)
1789+
1790+
@resource_override(resource_type="index")
1791+
@traced(name="contextgrounding_delete_by_name", run_type="uipath")
1792+
async def delete_by_name_async(
1793+
self,
1794+
name: str,
1795+
folder_key: Optional[str] = None,
1796+
folder_path: Optional[str] = None,
1797+
) -> None:
1798+
"""Asynchronously delete a context grounding index by its name.
1799+
1800+
This method retrieves the index by name and then deletes it.
1801+
1802+
Args:
1803+
name (str): The name of the context index to delete.
1804+
folder_key (Optional[str]): The key of the folder where the index resides.
1805+
folder_path (Optional[str]): The path of the folder where the index resides.
1806+
1807+
Raises:
1808+
Exception: If no index with the given name is found.
1809+
"""
1810+
index = await self.retrieve_async(
1811+
name, folder_key=folder_key, folder_path=folder_path
1812+
)
1813+
await self.delete_index_async(
1814+
index, folder_key=folder_key, folder_path=folder_path
1815+
)
1816+
1817+
@resource_override(resource_type="index")
1818+
@traced(name="contextgrounding_exists", run_type="uipath")
1819+
@resource_override(resource_type="index")
1820+
@traced(name="contextgrounding_ingest_by_name", run_type="uipath")
1821+
def ingest_by_name(
1822+
self,
1823+
name: str,
1824+
folder_key: Optional[str] = None,
1825+
folder_path: Optional[str] = None,
1826+
) -> None:
1827+
"""Trigger ingestion on a context grounding index by its name.
1828+
1829+
This method retrieves the index by name and then triggers data ingestion.
1830+
1831+
Args:
1832+
name (str): The name of the context index to ingest.
1833+
folder_key (Optional[str]): The key of the folder where the index resides.
1834+
folder_path (Optional[str]): The path of the folder where the index resides.
1835+
1836+
Raises:
1837+
Exception: If no index with the given name is found.
1838+
IngestionInProgressException: If ingestion is already in progress.
1839+
"""
1840+
index = self.retrieve(name, folder_key=folder_key, folder_path=folder_path)
1841+
self.ingest_data(index, folder_key=folder_key, folder_path=folder_path)
1842+
1843+
@resource_override(resource_type="index")
1844+
@traced(name="contextgrounding_ingest_by_name", run_type="uipath")
1845+
async def ingest_by_name_async(
1846+
self,
1847+
name: str,
1848+
folder_key: Optional[str] = None,
1849+
folder_path: Optional[str] = None,
1850+
) -> None:
1851+
"""Asynchronously trigger ingestion on a context grounding index by its name.
1852+
1853+
This method retrieves the index by name and then triggers data ingestion.
1854+
1855+
Args:
1856+
name (str): The name of the context index to ingest.
1857+
folder_key (Optional[str]): The key of the folder where the index resides.
1858+
folder_path (Optional[str]): The path of the folder where the index resides.
1859+
1860+
Raises:
1861+
Exception: If no index with the given name is found.
1862+
IngestionInProgressException: If ingestion is already in progress.
1863+
"""
1864+
index = await self.retrieve_async(
1865+
name, folder_key=folder_key, folder_path=folder_path
1866+
)
1867+
await self.ingest_data_async(
1868+
index, folder_key=folder_key, folder_path=folder_path
1869+
)
1870+
16931871
def _ingest_spec(
16941872
self,
16951873
key: str,
@@ -1722,6 +1900,24 @@ def _retrieve_across_folders_spec(
17221900
params=params,
17231901
)
17241902

1903+
def _list_spec(
1904+
self,
1905+
folder_key: Optional[str] = None,
1906+
folder_path: Optional[str] = None,
1907+
) -> RequestSpec:
1908+
folder_key = self._resolve_folder_key(folder_key, folder_path)
1909+
1910+
return RequestSpec(
1911+
method="GET",
1912+
endpoint=Endpoint("/ecs_/v2/indexes"),
1913+
params={
1914+
"$expand": "dataSource",
1915+
},
1916+
headers={
1917+
**header_folder(folder_key, None),
1918+
},
1919+
)
1920+
17251921
def _retrieve_spec(
17261922
self,
17271923
name: str,

packages/uipath-platform/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.10.38"
3+
version = "2.10.39"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

0 commit comments

Comments
 (0)