fix(utils.py): fix vertex anthropic streaming

This commit is contained in:
Krrish Dholakia 2024-07-03 18:43:46 -07:00
parent 46800ba20a
commit 4a6471e075
4 changed files with 22 additions and 202 deletions

View file

@ -8035,6 +8035,10 @@ class CustomStreamWrapper:
str_line = chunk
if isinstance(chunk, bytes): # Handle binary data
str_line = chunk.decode("utf-8") # Convert bytes to string
index = str_line.find("data:")
if index != -1:
str_line = str_line[index:]
text = ""
is_finished = False
finish_reason = None