From f4864cccff0eb41b5332a9c2a264b5208df49235 Mon Sep 17 00:00:00 2001 From: radu-mocanu Date: Tue, 23 Dec 2025 15:55:36 +0200 Subject: [PATCH 1/2] feat: add missing context tool values --- src/uipath/agent/models/agent.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uipath/agent/models/agent.py b/src/uipath/agent/models/agent.py index 532f9f0d4..fecbe2bd7 100644 --- a/src/uipath/agent/models/agent.py +++ b/src/uipath/agent/models/agent.py @@ -146,8 +146,9 @@ class AgentUnknownResourceConfig(BaseAgentResourceConfig): class AgentContextQuerySetting(BaseCfg): """Agent context query setting model.""" - description: Optional[str] = Field(None) - variant: Optional[str] = Field(None) + value: str | None = Field(None) + description: str | None = Field(None) + variant: str | None = Field(None) class AgentContextValueSetting(BaseCfg): From d4d37d17d8e7fd1e07f8df1c163c3cff5ad300e0 Mon Sep 17 00:00:00 2001 From: radu-mocanu Date: Wed, 24 Dec 2025 13:00:41 +0200 Subject: [PATCH 2/2] fix: support batch transform file download to nested dir --- pyproject.toml | 2 +- .../_context_grounding_service.py | 5 + .../test_context_grounding_service.py | 101 ++++++++++++++++++ uv.lock | 2 +- 4 files changed, 108 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 751fe6208..3b5f56f47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.2.44" +version = "2.2.45" description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools." readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/src/uipath/platform/context_grounding/_context_grounding_service.py b/src/uipath/platform/context_grounding/_context_grounding_service.py index 218352e29..8d58cfef8 100644 --- a/src/uipath/platform/context_grounding/_context_grounding_service.py +++ b/src/uipath/platform/context_grounding/_context_grounding_service.py @@ -1,3 +1,4 @@ +from pathlib import Path from typing import Annotated, Any, Dict, List, Optional, Tuple, Union import httpx @@ -719,6 +720,8 @@ def download_batch_transform_result( ) uri_response = BatchTransformReadUriResponse.model_validate(response.json()) + Path(destination_path).parent.mkdir(parents=True, exist_ok=True) + with open(destination_path, "wb") as file: with httpx.Client(**get_httpx_client_kwargs()) as client: file_content = client.get(uri_response.uri).content @@ -769,6 +772,8 @@ async def download_batch_transform_result_async( download_response = await client.get(uri_response.uri) file_content = download_response.content + Path(destination_path).parent.mkdir(parents=True, exist_ok=True) + with open(destination_path, "wb") as file: file.write(file_content) diff --git a/tests/sdk/services/test_context_grounding_service.py b/tests/sdk/services/test_context_grounding_service.py index de8a9c407..72efef02c 100644 --- a/tests/sdk/services/test_context_grounding_service.py +++ b/tests/sdk/services/test_context_grounding_service.py @@ -1709,3 +1709,104 @@ async def test_download_batch_transform_result_async( sent_requests[1].headers[HEADER_USER_AGENT] == f"UiPath.Python.Sdk/UiPath.Python.Sdk.Activities.ContextGroundingService.download_batch_transform_result_async/{version}" ) + + def test_download_batch_transform_result_creates_nested_directories( + self, + httpx_mock: HTTPXMock, + service: ContextGroundingService, + base_url: str, + org: str, + tenant: str, + tmp_path, + ) -> None: + httpx_mock.add_response( + url=f"{base_url}{org}{tenant}/ecs_/v2/batchRag/test-batch-id", + status_code=200, + json={ + "id": "test-batch-id", + "name": "test-batch-transform", + "lastBatchRagStatus": "Successful", + "prompt": "Summarize documents", + "targetFileGlobPattern": "**", + "useWebSearchGrounding": False, + "outputColumns": [ + {"name": "summary", "description": "Document summary"} + ], + "createdDate": "2024-01-15T10:30:00Z", + }, + ) + + httpx_mock.add_response( + url=f"{base_url}{org}{tenant}/ecs_/v2/batchRag/test-batch-id/GetReadUri", + status_code=200, + json={ + "uri": "https://storage.example.com/result.csv", + }, + ) + + httpx_mock.add_response( + url="https://storage.example.com/result.csv", + status_code=200, + content=b"col1,col2\nval1,val2", + ) + + destination = tmp_path / "output" / "nested" / "result.csv" + service.download_batch_transform_result( + id="test-batch-id", + destination_path=str(destination), + ) + + assert destination.exists() + assert destination.read_bytes() == b"col1,col2\nval1,val2" + assert destination.parent.exists() + + @pytest.mark.anyio + async def test_download_batch_transform_result_async_creates_nested_directories( + self, + httpx_mock: HTTPXMock, + service: ContextGroundingService, + base_url: str, + org: str, + tenant: str, + tmp_path, + ) -> None: + httpx_mock.add_response( + url=f"{base_url}{org}{tenant}/ecs_/v2/batchRag/test-batch-id", + status_code=200, + json={ + "id": "test-batch-id", + "name": "test-batch-transform", + "lastBatchRagStatus": "Successful", + "prompt": "Summarize documents", + "targetFileGlobPattern": "**", + "useWebSearchGrounding": False, + "outputColumns": [ + {"name": "summary", "description": "Document summary"} + ], + "createdDate": "2024-01-15T10:30:00Z", + }, + ) + + httpx_mock.add_response( + url=f"{base_url}{org}{tenant}/ecs_/v2/batchRag/test-batch-id/GetReadUri", + status_code=200, + json={ + "uri": "https://storage.example.com/result.csv", + }, + ) + + httpx_mock.add_response( + url="https://storage.example.com/result.csv", + status_code=200, + content=b"col1,col2\nval1,val2", + ) + + destination = tmp_path / "output" / "nested" / "result.csv" + await service.download_batch_transform_result_async( + id="test-batch-id", + destination_path=str(destination), + ) + + assert destination.exists() + assert destination.read_bytes() == b"col1,col2\nval1,val2" + assert destination.parent.exists() diff --git a/uv.lock b/uv.lock index 313d093cd..a4209acee 100644 --- a/uv.lock +++ b/uv.lock @@ -2477,7 +2477,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.2.44" +version = "2.2.45" source = { editable = "." } dependencies = [ { name = "click" },