LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
PythonlangsmithanonymizerRuleNodeProcessorrules
Attributeā—Since v0.1

rules

Copy
rules: list[StringNodeRule] = [{'pattern': rule['pattern'] if isinstance(
  rule['pattern']
View source on GitHub
,
re
.
Pattern
)
else
re
.
compile
(
rule
[
'pattern'
]
)
,
'replace'
:
rule
[
'replace'
]
if
isinstance
(
rule
.
get
(
'replace'
)
,
str
)
else
'[redacted]'
}
for
rule
in
rules
]

List of rules to apply for replacing sensitive data.

Each rule is a StringNodeRule, which contains a regex pattern to match and an optional replacement string.