itemgetter("question")        | retriever        | _combine_documents        | anonymizer.anonymize,        "anonymized_question": lambda x: anonymizer.anonymize(x["question"]),    }    | prompt    | model    | StrOutputParser()    | RunnableLambda(anonymizer.deanonymize))print(    chain_with_deanonymization.invoke(        "Where did the theft of the wallet occur, at what time, and who was it stolen from?"    ))    The theft of the wallet occurred in the vicinity of Kilmarnock during a bike trip. It was stolen from John Doe. The time of the theft was 9:30 AM.print(    chain_with_deanonymization.invoke("What was the content of the wallet in detail?"))    The content of the wallet included:    1. Credit card number: 4111 1111 1111 1111    2. Bank account number: PL61109010140000071219812874    3. Driver's license number: 999000680    4. Social Security Number: 602-76-4532    5. Polish identity card number: ABC123456print(chain_with_deanonymization.invoke("Whose phone number is it: 999-888-7777?"))    The phone number 999-888-7777 belongs to John Doe.PreviousMulti-language anonymizationNextPydantic compatibilityQuickstartIterative process of upgrading the anonymizerQuestion-answering system with PII anonymizationAlternative approach: local embeddings + anonymizing the context after indexingCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Open In Colab
Open In Colab ->: itemgetter("question")        | retriever        | _combine_documents        | anonymizer.anonymize,        "anonymized_question": lambda x: anonymizer.anonymize(x["question"]),    }    | prompt    | model    | StrOutputParser()    | RunnableLambda(anonymizer.deanonymize))print(    chain_with_deanonymization.invoke(        "Where did the theft of the wallet occur, at what time, and who was it stolen from?"    ))    The theft of the wallet occurred in the vicinity of Kilmarnock during a bike trip. It was stolen from John Doe. The time of the theft was 9:30 AM.print(    chain_with_deanonymization.invoke("What was the content of the wallet in detail?"))    The content of the wallet included:    1. Credit card number: 4111 1111 1111 1111    2. Bank account number: PL61109010140000071219812874    3. Driver's license number: 999000680    4. Social Security Number: 602-76-4532    5. Polish identity card number: ABC123456print(chain_with_deanonymization.invoke("Whose phone number is it: 999-888-7777?"))    The phone number 999-888-7777 belongs to John Doe.PreviousMulti-language anonymizationNextPydantic compatibilityQuickstartIterative process of upgrading the anonymizerQuestion-answering system with PII anonymizationAlternative approach: local embeddings + anonymizing the context after indexingCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.