From 7849c29f70a12660e0798237888c6656cd6213cc Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 6 Apr 2024 17:36:56 -0700 Subject: [PATCH] async anthropic streaming --- litellm/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index 5153a414b..1e67d63e5 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -8710,7 +8710,9 @@ class CustomStreamWrapper: return hold, curr_chunk def handle_anthropic_chunk(self, chunk): - str_line = chunk.decode("utf-8") # Convert bytes to string + str_line = chunk + if isinstance(chunk, bytes): # Handle binary data + str_line = chunk.decode("utf-8") # Convert bytes to string text = "" is_finished = False finish_reason = None @@ -9970,6 +9972,7 @@ class CustomStreamWrapper: or self.custom_llm_provider == "custom_openai" or self.custom_llm_provider == "text-completion-openai" or self.custom_llm_provider == "azure_text" + or self.custom_llm_provider == "anthropic" or self.custom_llm_provider == "huggingface" or self.custom_llm_provider == "ollama" or self.custom_llm_provider == "ollama_chat"