Commit f5436b14

stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
2025-01-07 01:15:50
chore: add missing isclass check (#1988)
1 parent 7117a18
Changed files (1)
src
openai
src/openai/_models.py
@@ -513,7 +513,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]