FIRAS TLILI
git clone https://github.com/TLILIFIRAS/Q-A-System-with-PII-Anonymization.git
pip install -r requirements.txt
export OPENAI_API_KEY="your_openai_api_key"
langchain_core.documents import Document from langchain_experimental.data_anonymizer import PresidioReversibleAnonymizer from langchain_openai import ChatOpenAI # Initialize your anonymizer and model anonymizer = PresidioReversibleAnonymizer() model = ChatOpenAI(temperature=0.3) # Load your documents documents = [Document(page_content="Your document content here.")]
for doc in documents: doc.page_content = anonymizer.anonymize(doc.page_content)
answer = anonymizer_chain.invoke({"question": "What happened on ?"}) print(answer)