Home / Class/ PIIDetectionError Class — langchain Architecture

PIIDetectionError Class — langchain Architecture

Architecture documentation for the PIIDetectionError class in _redaction.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  2664a7f2_5314_35a9_a86d_2fce142dd0cf["PIIDetectionError"]
  be639235_9a02_cc2d_5a7d_637d822fb3b3["_redaction.py"]
  2664a7f2_5314_35a9_a86d_2fce142dd0cf -->|defined in| be639235_9a02_cc2d_5a7d_637d822fb3b3
  be537d4a_bab7_0ef4_ec19_ffd6b19b5707["__init__()"]
  2664a7f2_5314_35a9_a86d_2fce142dd0cf -->|method| be537d4a_bab7_0ef4_ec19_ffd6b19b5707

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/_redaction.py lines 29–43

class PIIDetectionError(Exception):
    """Raised when configured to block on detected sensitive values."""

    def __init__(self, pii_type: str, matches: Sequence[PIIMatch]) -> None:
        """Initialize the exception with match context.

        Args:
            pii_type: Name of the detected sensitive type.
            matches: All matches that were detected for that type.
        """
        self.pii_type = pii_type
        self.matches = list(matches)
        count = len(matches)
        msg = f"Detected {count} instance(s) of {pii_type} in text content"
        super().__init__(msg)

Frequently Asked Questions

What is the PIIDetectionError class?
PIIDetectionError is a class in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/_redaction.py.
Where is PIIDetectionError defined?
PIIDetectionError is defined in libs/langchain_v1/langchain/agents/middleware/_redaction.py at line 29.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free