Lynch would be very grateful!And now, using the deanonymize method, we can reverse the process:print(anonymizer.deanonymize(anonymized_text))    Slim Shady recently lost his wallet.     Inside is some cash and his credit card with the number 4916 0387 9536 0861.     If you would find it, please call at 313-666-7440 or write an email here: real.slim.shady@gmail.com.    Slim Shady would be very grateful!Using with LangChain Expression Language‚ÄãWith LCEL we can easily chain together anonymization and deanonymization with the rest of our application. This is an example of using the anonymization mechanism with a query to LLM (without deanonymization for now):text = f"""Slim Shady recently lost his wallet. Inside is some cash and his credit card with the number 4916 0387 9536 0861. If you would find it, please call at 313-666-7440 or write an email here: real.slim.shady@gmail.com."""from langchain.prompts.prompt import PromptTemplatefrom langchain.chat_models import ChatOpenAIanonymizer = PresidioReversibleAnonymizer()template = """Rewrite this text into an official, short email:{anonymized_text}"""prompt = PromptTemplate.from_template(template)llm = ChatOpenAI(temperature=0)chain = {"anonymized_text": anonymizer.anonymize} | prompt | llmresponse = chain.invoke(text)print(response.content)    Dear Sir/Madam,        We regret to inform you that Monique Turner has recently misplaced his wallet, which contains a sum of cash and his credit card with the number 213152056829866.         If you happen to come across this wallet, kindly contact us at (770)908-7734x2835 or send an email to barbara25@example.net.        Thank you for your cooperation.        Sincerely,    [Your Name]Now, let's add deanonymization step to our sequence:chain = chain | (lambda ai_message: anonymizer.deanonymize(ai_message.content))response = chain.invoke(text)print(response)    Dear Sir/Madam,        We regret to inform you that Slim Shady has recently misplaced his wallet, which contains a sum of
Open In Colab
Open In Colab ->: Lynch would be very grateful!And now, using the deanonymize method, we can reverse the process:print(anonymizer.deanonymize(anonymized_text))    Slim Shady recently lost his wallet.     Inside is some cash and his credit card with the number 4916 0387 9536 0861.     If you would find it, please call at 313-666-7440 or write an email here: real.slim.shady@gmail.com.    Slim Shady would be very grateful!Using with LangChain Expression Language‚ÄãWith LCEL we can easily chain together anonymization and deanonymization with the rest of our application. This is an example of using the anonymization mechanism with a query to LLM (without deanonymization for now):text = f"""Slim Shady recently lost his wallet. Inside is some cash and his credit card with the number 4916 0387 9536 0861. If you would find it, please call at 313-666-7440 or write an email here: real.slim.shady@gmail.com."""from langchain.prompts.prompt import PromptTemplatefrom langchain.chat_models import ChatOpenAIanonymizer = PresidioReversibleAnonymizer()template = """Rewrite this text into an official, short email:{anonymized_text}"""prompt = PromptTemplate.from_template(template)llm = ChatOpenAI(temperature=0)chain = {"anonymized_text": anonymizer.anonymize} | prompt | llmresponse = chain.invoke(text)print(response.content)    Dear Sir/Madam,        We regret to inform you that Monique Turner has recently misplaced his wallet, which contains a sum of cash and his credit card with the number 213152056829866.         If you happen to come across this wallet, kindly contact us at (770)908-7734x2835 or send an email to barbara25@example.net.        Thank you for your cooperation.        Sincerely,    [Your Name]Now, let's add deanonymization step to our sequence:chain = chain | (lambda ai_message: anonymizer.deanonymize(ai_message.content))response = chain.invoke(text)print(response)    Dear Sir/Madam,        We regret to inform you that Slim Shady has recently misplaced his wallet, which contains a sum of