(fix) only decode chunk when it's not a str

This commit is contained in:
ishaan-jaff 2023-11-16 12:23:49 -08:00
parent f582189cea
commit 04971674b4

View file

@ -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 = ""