Code
The following code creates a function that takes a text string containing sensitive information and returns an anonymized version along with the replacements made:Key concepts
This implementation showcases several important ControlFlow features:-
Pydantic models: We use a Pydantic model (
AnonymizationResult
) to define the structure of our anonymization result. This ensures that the task returns well-structured, consistent results including the original text, anonymized text, and replacements made. -
Context passing: We pass the original text as context to the task, providing all necessary information for the anonymization process.