Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

chore: remove temp fix for optional params support #27

Merged
merged 4 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/toolbox_llamaindex/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ def _schema_to_model(model_name: str, schema: list[ParameterSchema]) -> Type[Bas
field_definitions[field.name] = cast(
Any,
(
# TODO: Remove the hardcoded optional types once optional fields
# are supported by Toolbox.
Optional[_parse_type(field)],
_parse_type(field),
Field(description=field.description),
),
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ def test_schema_to_model(self):
model = _schema_to_model("TestModel", schema)
assert issubclass(model, BaseModel)

assert model.model_fields["param1"].annotation == Union[str, None]
assert model.model_fields["param1"].annotation == str
assert model.model_fields["param1"].description == "Parameter 1"
assert model.model_fields["param2"].annotation == Union[int, None]
assert model.model_fields["param2"].annotation == int
assert model.model_fields["param2"].description == "Parameter 2"

def test_schema_to_model_empty(self):
Expand Down