diff --git a/src/toolbox_langchain/utils.py b/src/toolbox_langchain/utils.py index ab3eb349..cc6d6f9a 100644 --- a/src/toolbox_langchain/utils.py +++ b/src/toolbox_langchain/utils.py @@ -13,7 +13,7 @@ # limitations under the License. import json -from typing import Any, Callable, Optional, Type, cast +from typing import Any, Callable, Optional, Type, Union, cast from warnings import warn from aiohttp import ClientSession @@ -131,7 +131,7 @@ def _parse_type(type_: str) -> Any: elif type_ == "boolean": return bool elif type_ == "array": - return list + return list[Union[str, int, float, bool]] else: raise ValueError(f"Unsupported schema type: {type_}") diff --git a/tests/test_utils.py b/tests/test_utils.py index 5e481dc7..71bec4e3 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -171,7 +171,7 @@ def test_schema_to_model_empty(self): ("integer", int), ("float", float), ("boolean", bool), - ("array", list), + ("array", list[Union[str, int, float, bool]]), ], ) def test_parse_type(self, type_string, expected_type):