From 04971674b4e5b0a64e40d37122e452501deae1cf Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Thu, 16 Nov 2023 12:23:49 -0800 Subject: [PATCH] (fix) only decode chunk when it's not a str --- litellm/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index 2a01eadbf77..05e84329e6b 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -4367,7 +4367,8 @@ class CustomStreamWrapper: def handle_huggingface_chunk(self, chunk): try: - chunk = chunk.decode("utf-8") # DO NOT REMOVE this: This is required for HF inference API + Streaming + if type(chunk) != str: + chunk = chunk.decode("utf-8") # DO NOT REMOVE this: This is required for HF inference API + Streaming text = "" is_finished = False finish_reason = ""