def _load_single_chat_session(
        self, cursor: "sqlite3.Cursor", chat_id: int
    ) -> ChatSession:
        """
        Load a single chat session from the iMessage chat.db.
        Args:
            cursor: SQLite cursor object.
            chat_id (int): ID of the chat session to load.
        Returns:
            ChatSession: Loaded chat session.
        """
        results: List[HumanMessage] = []
        query = """
        SELECT message.date, handle.id, message.text, message.attributedBody
        FROM message
        JOIN chat_message_join ON message.ROWID = chat_message_join.message_id
        JOIN handle ON message.handle_id = handle.ROWID
        WHERE chat_message_join.chat_id = ?
        ORDER BY message.date ASC;
        """
        cursor.execute(query, (chat_id,))
        messages = cursor.fetchall()
        for date, sender, text, attributedBody in messages:
            if text:
                content = text
            elif attributedBody:
                content = self._parse_attributedBody(attributedBody)
            else:  # Skip messages with no content
                continue
            results.append(
                HumanMessage(
                    role=sender,
                    content=content,
                    additional_kwargs={
                        "message_time": date,
                        "sender": sender,
                    },
                )
            )
        return ChatSession(messages=results)
[docs]    def lazy_load(self) -> Iterator[ChatSession]:
        """
        Lazy load the chat sessions from the iMessage chat.db
        and yield them in the required format.
        Yields:
            ChatSession: Loaded chat session.
        """
        import sqlite3
        try:
            conn = sqlite3.connect(self.db_path)