Skip to content

Commit

Permalink
chore: add missing isclass check (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Jan 6, 2025
1 parent 3f7627d commit efcd898
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/anthropic/_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 efcd898

Please sign in to comment.