mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix(utils.py): fix streaming issue
This commit is contained in:
parent
39d8645596
commit
94f4f96994
1 changed files with 6 additions and 3 deletions
|
@ -282,9 +282,12 @@ class Delta(OpenAIObject):
|
||||||
if tool_calls is not None and isinstance(tool_calls, list):
|
if tool_calls is not None and isinstance(tool_calls, list):
|
||||||
self.tool_calls = []
|
self.tool_calls = []
|
||||||
for tool_call in tool_calls:
|
for tool_call in tool_calls:
|
||||||
if tool_call.get("index", None) is None:
|
if isinstance(tool_call, dict):
|
||||||
tool_call["index"] = 0
|
if tool_call.get("index", None) is None:
|
||||||
self.tool_calls.append(ChatCompletionDeltaToolCall(**tool_call))
|
tool_call["index"] = 0
|
||||||
|
self.tool_calls.append(ChatCompletionDeltaToolCall(**tool_call))
|
||||||
|
elif isinstance(tool_call, ChatCompletionDeltaToolCall):
|
||||||
|
self.tool_calls.append(tool_call)
|
||||||
else:
|
else:
|
||||||
self.tool_calls = tool_calls
|
self.tool_calls = tool_calls
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue