Skip to content

Commit 0384114

Browse files
authored
fix: Fix the errors showing up after setting up mypy type checker. (#74)
1 parent 674ccee commit 0384114

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/toolbox_langchain_sdk/utils.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Optional, Type
1+
from typing import Any, Optional, Type, cast
22

33
import yaml
44
from aiohttp import ClientSession
@@ -51,10 +51,13 @@ def _schema_to_model(model_name: str, schema: list[ParameterSchema]) -> Type[Bas
5151
"""
5252
field_definitions = {}
5353
for field in schema:
54-
field_definitions[field.name] = (
55-
# TODO: Remove the hardcoded optional types once optional fields are supported by Toolbox.
56-
Optional[_parse_type(field.type)],
57-
Field(description=field.description),
54+
field_definitions[field.name] = cast(
55+
Any,
56+
(
57+
# TODO: Remove the hardcoded optional types once optional fields are supported by Toolbox.
58+
Optional[_parse_type(field.type)],
59+
Field(description=field.description),
60+
),
5861
)
5962

6063
return create_model(model_name, **field_definitions)

0 commit comments

Comments
 (0)