Skip to content

Commit

Permalink
small improvemtn
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Dec 18, 2024
1 parent 01fcb80 commit 55fcdda
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,14 @@ def _message_to_content(self, message: ChatMessage) -> Content:
else:
msg = f"Unsupported message role {message.role}"
raise ValueError(msg)
role = (
"user"
if message.is_from(ChatRole.USER)

role = "model"
if (
message.is_from(ChatRole.USER)
or message.is_from(ChatRole.FUNCTION)
or ("TOOL" in ChatRole._member_names_ and message.is_from(ChatRole.TOOL))
else "model"
)
):
role = "user"
return Content(parts=[part], role=role)

@component.output_types(replies=List[ChatMessage])
Expand Down

0 comments on commit 55fcdda

Please sign in to comment.