from talk_box.conversation import Conversation
convo = Conversation()
convo.add_user_message("First")
convo.add_assistant_message("Second")
convo.get_last_message().content'Second'
Return the most recent message, optionally filtered by role.
Usage
Useful for quickly inspecting the latest assistant response or checking what the user last said without iterating the full history.
role: Optional[str] = NoneNone, returns the last message regardless of role.
Message | NoneNone if the conversation is empty (or no messages match the given role).