Home / Function/ _process_content() — langchain Function Reference

_process_content() — langchain Function Reference

Architecture documentation for the _process_content() function in pii.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  ffe55823_7c55_8b73_2be6_a2b281bb64cf["_process_content()"]
  dc527b75_da40_4d1c_e472_82d1252ba70b["PIIMiddleware"]
  ffe55823_7c55_8b73_2be6_a2b281bb64cf -->|defined in| dc527b75_da40_4d1c_e472_82d1252ba70b
  e81931fa_c61c_8dac_e9d4_8b63fbff471d["before_model()"]
  e81931fa_c61c_8dac_e9d4_8b63fbff471d -->|calls| ffe55823_7c55_8b73_2be6_a2b281bb64cf
  27d4728e_2258_70e9_e8c8_f68e263ca8fb["after_model()"]
  27d4728e_2258_70e9_e8c8_f68e263ca8fb -->|calls| ffe55823_7c55_8b73_2be6_a2b281bb64cf
  style ffe55823_7c55_8b73_2be6_a2b281bb64cf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/pii.py lines 161–167

    def _process_content(self, content: str) -> tuple[str, list[PIIMatch]]:
        """Apply the configured redaction rule to the provided content."""
        matches = self.detector(content)
        if not matches:
            return content, []
        sanitized = apply_strategy(content, matches, self.strategy)
        return sanitized, matches

Domain

Subdomains

Frequently Asked Questions

What does _process_content() do?
_process_content() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/pii.py.
Where is _process_content() defined?
_process_content() is defined in libs/langchain_v1/langchain/agents/middleware/pii.py at line 161.
What calls _process_content()?
_process_content() is called by 2 function(s): after_model, before_model.

Analyze Your Own Codebase

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

Try Supermodel Free