Skip to content

Commit 9c4f0d1

Browse files
authored
fix(langchain-sdk): Fix issue occurring when using a tool with list type. (#33)
1 parent d0ff74e commit 9c4f0d1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/toolbox_langchain/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16-
from typing import Any, Callable, Optional, Type, cast
16+
from typing import Any, Callable, Optional, Type, Union, cast
1717
from warnings import warn
1818

1919
from aiohttp import ClientSession
@@ -131,7 +131,7 @@ def _parse_type(type_: str) -> Any:
131131
elif type_ == "boolean":
132132
return bool
133133
elif type_ == "array":
134-
return list
134+
return list[Union[str, int, float, bool]]
135135
else:
136136
raise ValueError(f"Unsupported schema type: {type_}")
137137

tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def test_schema_to_model_empty(self):
171171
("integer", int),
172172
("float", float),
173173
("boolean", bool),
174-
("array", list),
174+
("array", list[Union[str, int, float, bool]]),
175175
],
176176
)
177177
def test_parse_type(self, type_string, expected_type):

0 commit comments

Comments
 (0)