@@ -1113,14 +1113,7 @@ def _process_response(
11131113 ) -> ResponseT :
11141114 origin = get_origin (cast_to ) or cast_to
11151115
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 ):
11241117 if not issubclass (origin , APIResponse ):
11251118 raise TypeError (f"API Response types must subclass { APIResponse } ; Received { origin } " )
11261119
@@ -1625,14 +1618,7 @@ async def _process_response(
16251618 ) -> ResponseT :
16261619 origin = get_origin (cast_to ) or cast_to
16271620
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 ):
16361622 if not issubclass (origin , AsyncAPIResponse ):
16371623 raise TypeError (f"API Response types must subclass { AsyncAPIResponse } ; Received { origin } " )
16381624
0 commit comments