@@ -1113,14 +1113,7 @@ def _process_response(
1113
1113
) -> ResponseT :
1114
1114
origin = get_origin (cast_to ) or cast_to
1115
1115
1116
- if (
1117
- inspect .isclass (origin )
1118
- and issubclass (origin , BaseAPIResponse )
1119
- # we only want to actually return the custom BaseAPIResponse class if we're
1120
- # returning the raw response, or if we're not streaming SSE, as if we're streaming
1121
- # SSE then `cast_to` doesn't actively reflect the type we need to parse into
1122
- and (not stream or bool (response .request .headers .get (RAW_RESPONSE_HEADER )))
1123
- ):
1116
+ if inspect .isclass (origin ) and issubclass (origin , BaseAPIResponse ):
1124
1117
if not issubclass (origin , APIResponse ):
1125
1118
raise TypeError (f"API Response types must subclass { APIResponse } ; Received { origin } " )
1126
1119
@@ -1625,14 +1618,7 @@ async def _process_response(
1625
1618
) -> ResponseT :
1626
1619
origin = get_origin (cast_to ) or cast_to
1627
1620
1628
- if (
1629
- inspect .isclass (origin )
1630
- and issubclass (origin , BaseAPIResponse )
1631
- # we only want to actually return the custom BaseAPIResponse class if we're
1632
- # returning the raw response, or if we're not streaming SSE, as if we're streaming
1633
- # SSE then `cast_to` doesn't actively reflect the type we need to parse into
1634
- and (not stream or bool (response .request .headers .get (RAW_RESPONSE_HEADER )))
1635
- ):
1621
+ if inspect .isclass (origin ) and issubclass (origin , BaseAPIResponse ):
1636
1622
if not issubclass (origin , AsyncAPIResponse ):
1637
1623
raise TypeError (f"API Response types must subclass { AsyncAPIResponse } ; Received { origin } " )
1638
1624
0 commit comments