Skip to content

Commit

Permalink
fix: make Google Vertex Chat Generator compatible with new ChatMessage (
Browse files Browse the repository at this point in the history
#1255)

* make Vertex compatible with new ChatMessage

* fmt
  • Loading branch information
anakin87 authored Dec 19, 2024
1 parent 4f067b9 commit 07ca7a6
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,10 @@ def _get_response(self, response_body: GenerationResponse) -> List[ChatMessage]:
# Remove content from metadata
metadata.pop("content", None)
if part._raw_part.text != "":
replies.append(ChatMessage.from_assistant(content=part._raw_part.text, meta=metadata))
replies.append(ChatMessage.from_assistant(part._raw_part.text, meta=metadata))
elif part.function_call:
metadata["function_call"] = part.function_call
new_message = ChatMessage.from_assistant(
content=json.dumps(dict(part.function_call.args)), meta=metadata
)
new_message = ChatMessage.from_assistant(json.dumps(dict(part.function_call.args)), meta=metadata)
new_message.name = part.function_call.name
replies.append(new_message)
return replies
Expand Down

0 comments on commit 07ca7a6

Please sign in to comment.