Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 61d9072

Browse files
stainless-app[bot]stainless-bot
authored andcommittedJan 6, 2025·
chore: add missing isclass check (#1988)
1 parent bcbf013 commit 61d9072

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎src/openai/_models.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,11 @@ def construct_type(*, value: object, type_: object) -> object:
513513
_, items_type = get_args(type_) # Dict[_, items_type]
514514
return {key: construct_type(value=item, type_=items_type) for key, item in value.items()}
515515

516-
if not is_literal_type(type_) and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel)):
516+
if (
517+
not is_literal_type(type_)
518+
and inspect.isclass(origin)
519+
and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel))
520+
):
517521
if is_list(value):
518522
return [cast(Any, type_).construct(**entry) if is_mapping(entry) else entry for entry in value]
519523

0 commit comments

Comments
 (0)
Please sign in to comment.