Skip to content

Commit 20d0b75

Browse files
authored
fix: case-insensitive deserialization of variant field in context resource settings (#1485)
1 parent 5b4d584 commit 20d0b75

File tree

4 files changed

+64
-5
lines changed

4 files changed

+64
-5
lines changed

packages/uipath/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[project]
22
name = "uipath"
3-
version = "2.10.28"
3+
version = "2.10.29"
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"
77
dependencies = [
88
"uipath-core>=0.5.2, <0.6.0",
99
"uipath-runtime>=0.9.1, <0.10.0",
10-
"uipath-platform>=0.1.8, <0.2.0",
10+
"uipath-platform>=0.1.4, <0.2.0",
1111
"click>=8.3.1",
1212
"httpx>=0.28.1",
1313
"pyjwt>=2.10.1",

packages/uipath/src/uipath/agent/models/agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class AgentContextQuerySetting(BaseCfg):
325325

326326
value: str | None = Field(default=None)
327327
description: str | None = Field(default=None)
328-
variant: str | None = Field(default=None)
328+
variant: AgentToolArgumentPropertiesVariant | None = Field(default=None)
329329

330330

331331
class AgentContextValueSetting(BaseCfg):
@@ -373,7 +373,9 @@ class AgentContextSettings(BaseCfg):
373373
retrieval_mode: AgentContextRetrievalMode = Field(alias="retrievalMode")
374374
threshold: float = Field(default=0)
375375
query: AgentContextQuerySetting = Field(
376-
default_factory=lambda: AgentContextQuerySetting(variant="dynamic")
376+
default_factory=lambda: AgentContextQuerySetting(
377+
variant=AgentToolArgumentPropertiesVariant.DYNAMIC
378+
)
377379
)
378380
folder_path_prefix: Optional[AgentContextQuerySetting] = Field(
379381
None, alias="folderPathPrefix"

packages/uipath/tests/agent/models/test_agent.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,63 @@ def test_agent_with_unknown_context_retrieval_mode(self):
16471647
== AgentContextRetrievalMode.UNKNOWN
16481648
)
16491649

1650+
def test_context_settings_variant_case_insensitive(self):
1651+
"""Test that context query setting variant handles different casings."""
1652+
1653+
json_data = {
1654+
"id": "test-variant-case",
1655+
"name": "Agent with mixed-case variants",
1656+
"version": "1.0.0",
1657+
"settings": {
1658+
"model": "gpt-4o-2024-11-20",
1659+
"maxTokens": 16384,
1660+
"temperature": 0,
1661+
"engine": "basic-v1",
1662+
},
1663+
"inputSchema": {"type": "object", "properties": {}},
1664+
"outputSchema": {"type": "object", "properties": {}},
1665+
"resources": [
1666+
{
1667+
"$resourceType": "context",
1668+
"folderPath": "TestFolder",
1669+
"indexName": "Test Index",
1670+
"settings": {
1671+
"threshold": 0.5,
1672+
"resultCount": 5,
1673+
"retrievalMode": "semantic",
1674+
"query": {
1675+
"value": "{{searchQuery}}",
1676+
"variant": "Argument",
1677+
},
1678+
"folderPathPrefix": {
1679+
"variant": "Static",
1680+
"value": "/docs",
1681+
},
1682+
},
1683+
"name": "Test Context",
1684+
"description": "Context with mixed-case variants",
1685+
}
1686+
],
1687+
"messages": [{"role": "system", "content": "Test system message"}],
1688+
}
1689+
1690+
config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
1691+
json_data
1692+
)
1693+
1694+
context_resource = config.resources[0]
1695+
assert isinstance(context_resource, AgentContextResourceConfig)
1696+
assert context_resource.settings is not None
1697+
assert (
1698+
context_resource.settings.query.variant
1699+
== AgentToolArgumentPropertiesVariant.ARGUMENT
1700+
)
1701+
assert context_resource.settings.folder_path_prefix is not None
1702+
assert (
1703+
context_resource.settings.folder_path_prefix.variant
1704+
== AgentToolArgumentPropertiesVariant.STATIC
1705+
)
1706+
16501707
def test_agent_with_unknown_resource_type(self):
16511708
"""Test that AgentDefinition handles unknown resource types gracefully"""
16521709

packages/uipath/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)