mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
streaming fixes
This commit is contained in:
parent
e1c1493db2
commit
ab58e32e90
1 changed files with 4 additions and 2 deletions
|
@ -2454,7 +2454,6 @@ class CustomStreamWrapper:
|
||||||
def __next__(self):
|
def __next__(self):
|
||||||
try:
|
try:
|
||||||
# return this for all models
|
# return this for all models
|
||||||
model_response = ModelResponse(stream=True)
|
|
||||||
completion_obj = {"content": ""} # default to role being assistant
|
completion_obj = {"content": ""} # default to role being assistant
|
||||||
if self.model in litellm.anthropic_models:
|
if self.model in litellm.anthropic_models:
|
||||||
chunk = next(self.completion_stream)
|
chunk = next(self.completion_stream)
|
||||||
|
@ -2506,8 +2505,11 @@ class CustomStreamWrapper:
|
||||||
|
|
||||||
# LOGGING
|
# LOGGING
|
||||||
threading.Thread(target=self.logging_obj.success_handler, args=(completion_obj,)).start()
|
threading.Thread(target=self.logging_obj.success_handler, args=(completion_obj,)).start()
|
||||||
|
model_response = ModelResponse(stream=True)
|
||||||
|
model_response.choices[0].delta = completion_obj
|
||||||
|
model_response.model = self.model
|
||||||
|
|
||||||
if model_response.choices[0].delta.content == "<special_litellm_token>":
|
if model_response.choices[0].delta['content'] == "<special_litellm_token>":
|
||||||
model_response.choices[0].delta = {
|
model_response.choices[0].delta = {
|
||||||
"content": completion_obj["content"],
|
"content": completion_obj["content"],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue