Skip to content

Commit

Permalink
tutorial68
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed May 24, 2024
1 parent 29b8a65 commit 8066e70
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tutorial68/main.py
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)
5 changes: 5 additions & 0 deletions tutorial68/test.py
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 added tutorial68/tutorial68.pptx
Binary file not shown.

0 comments on commit 8066e70

Please sign in to comment.