def METHOD_NAME(self) -> List[ChatMessage]:
    """Get chat history."""
    message_count = len(self.chat_history)
    message_str = " ".join(
        [str(m.content) for m in self.chat_history[-message_count:]]
    )
    token_count = len(self.tokenizer_fn(message_str))
    while token_count > self.token_limit and message_count > 1:
        message_count -= 1
        message_str = " ".join(
            [str(m.content) for m in self.chat_history[-message_count:]]
        )
        token_count = len(self.tokenizer_fn(message_str))
    # catch one message longer than token limit
    if token_count > self.token_limit:
        return []
    return self.chat_history[-message_count:]