Skip to content

Commit

Permalink
chore: add missing isclass check (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 7, 2025
1 parent 412b55f commit a749def
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/honcho/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,11 @@ def construct_type(*, value: object, type_: object) -> object:
_, items_type = get_args(type_) # Dict[_, items_type]
return {key: construct_type(value=item, type_=items_type) for key, item in value.items()}

if not is_literal_type(type_) and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel)):
if (
not is_literal_type(type_)
and inspect.isclass(origin)
and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel))
):
if is_list(value):
return [cast(Any, type_).construct(**entry) if is_mapping(entry) else entry for entry in value]

Expand Down

0 comments on commit a749def

Please sign in to comment.