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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
5 changes: 3 additions & 2 deletions src/uipath/agent/models/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pathlib import Path
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union

import httpx
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
101 changes: 101 additions & 0 deletions tests/sdk/services/test_context_grounding_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading