Skip to content

Commit b99805d

Browse files
committed
fix: unwrap PEP 604 union types (X | None) in _unwrap_optional
1 parent c4efcd8 commit b99805d

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

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-langchain"
3-
version = "0.10.0"
3+
version = "0.10.1"
44
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath_langchain/agent/react/json_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ast
22
import json
33
import sys
4+
import types
45
from typing import Any, ForwardRef, Union, get_args, get_origin
56

67
from jsonpath_ng import parse # type: ignore[import-untyped]
@@ -183,7 +184,7 @@ def _unwrap_optional(annotation: Any) -> Any:
183184
The unwrapped type, or the original if not Optional/Union
184185
"""
185186
origin = get_origin(annotation)
186-
if origin is Union:
187+
if origin is Union or isinstance(annotation, types.UnionType):
187188
args = get_args(annotation)
188189
non_none_args = [arg for arg in args if arg is not type(None)]
189190
if non_none_args:

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)