From 32a1378570c7756914230ebd1b182fd0f3760dce Mon Sep 17 00:00:00 2001 From: cotovanu-cristian Date: Fri, 6 Mar 2026 22:48:19 +0200 Subject: [PATCH] fix: enum values in input schema --- packages/uipath/pyproject.toml | 2 +- packages/uipath/src/uipath/agent/utils/text_tokens.py | 2 ++ packages/uipath/tests/agent/utils/test_text_tokens.py | 11 +++++++++++ packages/uipath/uv.lock | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/uipath/pyproject.toml b/packages/uipath/pyproject.toml index 3990c8917..fb2709314 100644 --- a/packages/uipath/pyproject.toml +++ b/packages/uipath/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.10.8" +version = "2.10.9" 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/packages/uipath/src/uipath/agent/utils/text_tokens.py b/packages/uipath/src/uipath/agent/utils/text_tokens.py index fd1293ee2..ea60ef52f 100644 --- a/packages/uipath/src/uipath/agent/utils/text_tokens.py +++ b/packages/uipath/src/uipath/agent/utils/text_tokens.py @@ -133,4 +133,6 @@ def serialize_argument( return "" if isinstance(value, (list, dict, bool)): return json.dumps(value, ensure_ascii=False) + if hasattr(value, "value"): + return serialize_argument(value.value) return str(value) diff --git a/packages/uipath/tests/agent/utils/test_text_tokens.py b/packages/uipath/tests/agent/utils/test_text_tokens.py index abdbeec00..6b71f8ece 100644 --- a/packages/uipath/tests/agent/utils/test_text_tokens.py +++ b/packages/uipath/tests/agent/utils/test_text_tokens.py @@ -1,5 +1,7 @@ """Tests for text_tokens.py utils.""" +from enum import Enum + import pytest from uipath.agent.models.agent import TextToken, TextTokenType @@ -250,6 +252,11 @@ def test_null_intermediate_value(self): class TestSerializeValue: """Test value serialization.""" + class RiskTolerance(str, Enum): + """Test enum mirroring dynamic string enums in input schemas.""" + + LOW = "low" + def test_string(self): """Test serializing strings.""" assert serialize_argument("hello") == "hello" @@ -277,3 +284,7 @@ def test_boolean(self): """Test serializing booleans (JSON-style lowercase).""" assert serialize_argument(True) == "true" assert serialize_argument(False) == "false" + + def test_string_enum_uses_underlying_value(self): + """Test string enums serialize to their values for prompt interpolation.""" + assert serialize_argument(self.RiskTolerance.LOW) == "low" diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index a523694a2..c36619790 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -2531,7 +2531,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.10.8" +version = "2.10.9" source = { editable = "." } dependencies = [ { name = "applicationinsights" },