def set(self, messages: List[ChatMessage]) -> None:
        """Set chat history and add new messages to client memory."""
        initial_chat_len = len(self.primary_memory.get_all())
        # Insert only new chat messages
        self._add_msgs_to_client_memory(messages[initial_chat_len:])
        self.primary_memory.set(messages)
Set chat history and add new messages to client memory.
llama-index-integrations/memory/llama-index-memory-mem0/llama_index/memory/mem0/base.py