mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix streaming objects
This commit is contained in:
parent
29c3247753
commit
0b436cf767
4 changed files with 25 additions and 11 deletions
|
@ -103,7 +103,7 @@ class Choices(OpenAIObject):
|
|||
self.message = message
|
||||
|
||||
class StreamingChoices(OpenAIObject):
|
||||
def __init__(self, finish_reason="stop", index=0, delta=Delta(), **params):
|
||||
def __init__(self, finish_reason=None, index=0, delta: Optional[Delta]={}, **params):
|
||||
super(StreamingChoices, self).__init__(**params)
|
||||
self.finish_reason = finish_reason
|
||||
self.index = index
|
||||
|
@ -2493,7 +2493,10 @@ class CustomStreamWrapper:
|
|||
model_response.choices[0].delta = completion_obj
|
||||
return model_response
|
||||
except Exception as e:
|
||||
raise StopIteration
|
||||
model_response = ModelResponse(stream=True)
|
||||
model_response.choices[0].finish_reason = "stop"
|
||||
return model_response
|
||||
# raise StopIteration
|
||||
|
||||
async def __anext__(self):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue