mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
(fix) stream chunk builder when content == None in chunk
This commit is contained in:
parent
d7e215a3e0
commit
452bba1b5d
1 changed files with 3 additions and 1 deletions
|
@ -2092,7 +2092,7 @@ def stream_chunk_builder(chunks: list):
|
||||||
content_list = []
|
content_list = []
|
||||||
combined_content = ""
|
combined_content = ""
|
||||||
|
|
||||||
if "function_call" in chunks[0]["choices"][0]["delta"]:
|
if "function_call" in chunks[0]["choices"][0]["delta"] and chunks[0]["choices"][0]["delta"]["function_call"] is not None:
|
||||||
argument_list = []
|
argument_list = []
|
||||||
delta = chunks[0]["choices"][0]["delta"]
|
delta = chunks[0]["choices"][0]["delta"]
|
||||||
function_call = delta.get("function_call", "")
|
function_call = delta.get("function_call", "")
|
||||||
|
@ -2123,6 +2123,8 @@ def stream_chunk_builder(chunks: list):
|
||||||
for choice in choices:
|
for choice in choices:
|
||||||
delta = choice.get("delta", {})
|
delta = choice.get("delta", {})
|
||||||
content = delta.get("content", "")
|
content = delta.get("content", "")
|
||||||
|
if content == None:
|
||||||
|
continue # openai v1.0.0 sets content = None for chunks
|
||||||
content_list.append(content)
|
content_list.append(content)
|
||||||
|
|
||||||
# Combine the "content" strings into a single string
|
# Combine the "content" strings into a single string
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue