def pii_detection_with_cot_reasons(self, text: str):
        """
        NER model to detect PII, with reasons.

        Example:
            ```python
            hugs = Huggingface()

            # Define a pii_detection feedback function using HuggingFace.
            f_pii_detection = Feedback(hugs.pii_detection).on_input()
            ```

            Args:
                text: A text prompt that may contain a name.

            Returns:
                Tuple[float, str]: A tuple containing a the likelihood that a PII is contained in the input text and a string containing what PII is detected (if any).
        """
        likelihood_scores, reasons = (
            self._pii_detection_with_cot_reasons_endpoint(text)
        )

        # Calculate the sum of all individual likelihood scores (P(A) + P(B) + ...)
        sum_individual_probabilities = sum(likelihood_scores)

        # Initialize the total likelihood for at least one name
        total_likelihood = sum_individual_probabilities

        # Calculate the product of pairwise likelihood scores (P(A and B), P(A and C), ...)
        for i in range(len(likelihood_scores)):
            for j in range(i + 1, len(likelihood_scores)):
                pairwise_likelihood = (
                    likelihood_scores[i] * likelihood_scores[j]
                )
                total_likelihood -= pairwise_likelihood

        score = 1 - total_likelihood

        return score, reasons

        NER model to detect PII, with reasons.

        Example:
            ```python
            hugs = Huggingface()

            # Define a pii_detection feedback function using HuggingFace.
            f_pii_detection = Feedback(hugs.pii_detection).on_input()
            ```

            Args:
                text: A text prompt that may contain a name.

            Returns:
                Tuple[float, str]: A tuple containing a the likelihood that a PII is contained in the input text and a string containing what PII is detected (if any).
        
src/providers/huggingface/trulens/providers/huggingface/provider.py