Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Oct 15, 2024
1 parent 0fd8545 commit 0e93826
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,12 @@ def _get_stream_response(
for chunk in stream:
content: Union[str, Dict[str, Any]] = ""
dict_chunk = chunk.to_dict()
metadata = dict(dict_chunk) # we copy and store the whole chunk as metadata in streaming calls
metadata = dict(dict_chunk) # we copy and store the whole chunk as metadata in streaming calls
for candidate in dict_chunk["candidates"]:
for part in candidate["content"]["parts"]:
if "text" in part and part["text"] != "":
content = part["text"]
replies.append(
ChatMessage(content=content, role=ChatRole.ASSISTANT, meta=metadata, name=None)
)
replies.append(ChatMessage(content=content, role=ChatRole.ASSISTANT, meta=metadata, name=None))
elif "function_call" in part and len(part["function_call"]) > 0:
metadata["function_call"] = part["function_call"]
content = part["function_call"]["args"]
Expand Down

0 comments on commit 0e93826

Please sign in to comment.