def get_best_leaf(self) -> "SearchNode":
        """
        Get best leaf node.

        Get best leaf node across any children nodes.

        """
        # only get children that aren't done yet
        free_children = [c for c in self.children if not c.is_done]
        if not free_children:
            return self

        best_child = max(free_children, key=lambda x: x.upper_confidence_bound)
        return best_child.get_best_leaf()

        Get best leaf node.

        Get best leaf node across any children nodes.

        
llama-index-packs/llama-index-packs-agents-lats/llama_index/packs/agents_lats/types.py