Skip to content

Commit 75f6238

Browse files
authored
Merge pull request #1051 from UiPath/chore/add-missing-agent-values
feat: add missing context tool values
2 parents 7f878ce + d4d37d1 commit 75f6238

File tree

5 files changed

+111
-4
lines changed

5 files changed

+111
-4
lines changed

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.2.44"
3+
version = "2.2.45"
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"

src/uipath/agent/models/agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ class AgentUnknownResourceConfig(BaseAgentResourceConfig):
146146
class AgentContextQuerySetting(BaseCfg):
147147
"""Agent context query setting model."""
148148

149-
description: Optional[str] = Field(None)
150-
variant: Optional[str] = Field(None)
149+
value: str | None = Field(None)
150+
description: str | None = Field(None)
151+
variant: str | None = Field(None)
151152

152153

153154
class AgentContextValueSetting(BaseCfg):

src/uipath/platform/context_grounding/_context_grounding_service.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from pathlib import Path
12
from typing import Annotated, Any, Dict, List, Optional, Tuple, Union
23

34
import httpx
@@ -719,6 +720,8 @@ def download_batch_transform_result(
719720
)
720721
uri_response = BatchTransformReadUriResponse.model_validate(response.json())
721722

723+
Path(destination_path).parent.mkdir(parents=True, exist_ok=True)
724+
722725
with open(destination_path, "wb") as file:
723726
with httpx.Client(**get_httpx_client_kwargs()) as client:
724727
file_content = client.get(uri_response.uri).content
@@ -769,6 +772,8 @@ async def download_batch_transform_result_async(
769772
download_response = await client.get(uri_response.uri)
770773
file_content = download_response.content
771774

775+
Path(destination_path).parent.mkdir(parents=True, exist_ok=True)
776+
772777
with open(destination_path, "wb") as file:
773778
file.write(file_content)
774779

tests/sdk/services/test_context_grounding_service.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,3 +1709,104 @@ async def test_download_batch_transform_result_async(
17091709
sent_requests[1].headers[HEADER_USER_AGENT]
17101710
== f"UiPath.Python.Sdk/UiPath.Python.Sdk.Activities.ContextGroundingService.download_batch_transform_result_async/{version}"
17111711
)
1712+
1713+
def test_download_batch_transform_result_creates_nested_directories(
1714+
self,
1715+
httpx_mock: HTTPXMock,
1716+
service: ContextGroundingService,
1717+
base_url: str,
1718+
org: str,
1719+
tenant: str,
1720+
tmp_path,
1721+
) -> None:
1722+
httpx_mock.add_response(
1723+
url=f"{base_url}{org}{tenant}/ecs_/v2/batchRag/test-batch-id",
1724+
status_code=200,
1725+
json={
1726+
"id": "test-batch-id",
1727+
"name": "test-batch-transform",
1728+
"lastBatchRagStatus": "Successful",
1729+
"prompt": "Summarize documents",
1730+
"targetFileGlobPattern": "**",
1731+
"useWebSearchGrounding": False,
1732+
"outputColumns": [
1733+
{"name": "summary", "description": "Document summary"}
1734+
],
1735+
"createdDate": "2024-01-15T10:30:00Z",
1736+
},
1737+
)
1738+
1739+
httpx_mock.add_response(
1740+
url=f"{base_url}{org}{tenant}/ecs_/v2/batchRag/test-batch-id/GetReadUri",
1741+
status_code=200,
1742+
json={
1743+
"uri": "https://storage.example.com/result.csv",
1744+
},
1745+
)
1746+
1747+
httpx_mock.add_response(
1748+
url="https://storage.example.com/result.csv",
1749+
status_code=200,
1750+
content=b"col1,col2\nval1,val2",
1751+
)
1752+
1753+
destination = tmp_path / "output" / "nested" / "result.csv"
1754+
service.download_batch_transform_result(
1755+
id="test-batch-id",
1756+
destination_path=str(destination),
1757+
)
1758+
1759+
assert destination.exists()
1760+
assert destination.read_bytes() == b"col1,col2\nval1,val2"
1761+
assert destination.parent.exists()
1762+
1763+
@pytest.mark.anyio
1764+
async def test_download_batch_transform_result_async_creates_nested_directories(
1765+
self,
1766+
httpx_mock: HTTPXMock,
1767+
service: ContextGroundingService,
1768+
base_url: str,
1769+
org: str,
1770+
tenant: str,
1771+
tmp_path,
1772+
) -> None:
1773+
httpx_mock.add_response(
1774+
url=f"{base_url}{org}{tenant}/ecs_/v2/batchRag/test-batch-id",
1775+
status_code=200,
1776+
json={
1777+
"id": "test-batch-id",
1778+
"name": "test-batch-transform",
1779+
"lastBatchRagStatus": "Successful",
1780+
"prompt": "Summarize documents",
1781+
"targetFileGlobPattern": "**",
1782+
"useWebSearchGrounding": False,
1783+
"outputColumns": [
1784+
{"name": "summary", "description": "Document summary"}
1785+
],
1786+
"createdDate": "2024-01-15T10:30:00Z",
1787+
},
1788+
)
1789+
1790+
httpx_mock.add_response(
1791+
url=f"{base_url}{org}{tenant}/ecs_/v2/batchRag/test-batch-id/GetReadUri",
1792+
status_code=200,
1793+
json={
1794+
"uri": "https://storage.example.com/result.csv",
1795+
},
1796+
)
1797+
1798+
httpx_mock.add_response(
1799+
url="https://storage.example.com/result.csv",
1800+
status_code=200,
1801+
content=b"col1,col2\nval1,val2",
1802+
)
1803+
1804+
destination = tmp_path / "output" / "nested" / "result.csv"
1805+
await service.download_batch_transform_result_async(
1806+
id="test-batch-id",
1807+
destination_path=str(destination),
1808+
)
1809+
1810+
assert destination.exists()
1811+
assert destination.read_bytes() == b"col1,col2\nval1,val2"
1812+
assert destination.parent.exists()

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.

0 commit comments

Comments
 (0)