From bbd20aed899b449888411a8f113392dcf48d95e9 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Sun, 12 Nov 2023 01:15:35 -0500 Subject: [PATCH] feat(client): support return response_cls to string (#614) Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- openllm-client/src/openllm_client/_shim.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openllm-client/src/openllm_client/_shim.py b/openllm-client/src/openllm_client/_shim.py index b5fe92f2..8a9e6c33 100644 --- a/openllm-client/src/openllm_client/_shim.py +++ b/openllm-client/src/openllm_client/_shim.py @@ -134,6 +134,9 @@ class APIResponse(t.Generic[Response]): stream_cls = self._stream_cls or self._client._default_stream_cls return stream_cls(response_cls=self._response_cls, response=self._raw_response, client=self._client) + if self._response_cls is str: + return self._raw_response.text + content_type, *_ = self._raw_response.headers.get('content-type', '').split(';') if content_type != 'application/json': # Since users specific different content_type, then we return the raw binary text without and deserialisation