-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from langchain_experimental.data_anonymizer import PresidioAnonymizer | ||
from langchain_openai import ChatOpenAI | ||
from langchain.prompts import PromptTemplate | ||
anonymizer=PresidioAnonymizer() | ||
|
||
text=""" | ||
Mark George recently lost his car from the city mall parking in Newyork,the incident happend on 3 rd may 2024 | ||
his car details are as below: | ||
car model audi q76 , car number is mg6567 | ||
""" | ||
template=""" | ||
Write an official email with this text to address city insurance company | ||
{anonymized_text} | ||
""" | ||
prompt=PromptTemplate.from_template(template) | ||
llm=ChatOpenAI(model="gpt-4o") | ||
chain={"anonymized_text":anonymizer.anonymize} | prompt | llm | ||
response=chain.invoke(text) | ||
print(response.content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from langchain_experimental.data_anonymizer import PresidioAnonymizer | ||
anonymizer=PresidioAnonymizer() | ||
sample="my name is john smith , i am from USA , my email id is [email protected]" | ||
data=anonymizer.anonymize(sample) | ||
print(data) |
Binary file not shown.