mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix(huggingface_restapi.py): fix huggingface streaming error raising
This commit is contained in:
parent
766e8cba84
commit
873ddde924
3 changed files with 65 additions and 8 deletions
|
@ -8117,7 +8117,8 @@ class CustomStreamWrapper:
|
|||
text = "" # don't return the final bos token
|
||||
is_finished = True
|
||||
finish_reason = "stop"
|
||||
|
||||
elif data_json.get("error", False):
|
||||
raise Exception(data_json.get("error"))
|
||||
return {
|
||||
"text": text,
|
||||
"is_finished": is_finished,
|
||||
|
@ -8132,7 +8133,7 @@ class CustomStreamWrapper:
|
|||
}
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
# raise(e)
|
||||
raise e
|
||||
|
||||
def handle_ai21_chunk(self, chunk): # fake streaming
|
||||
chunk = chunk.decode("utf-8")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue