from langchain_ambientmeta import PrivacyLLMfrom langchain_openai import ChatOpenAI# Wrap your LLM with privacy protectionsafe_llm = PrivacyLLM( llm=ChatOpenAI(model="gpt-4"), api_key="am_live_xxx",)# Use normally — PII is automatically handledresponse = safe_llm.invoke("Summarize John Smith's file at john@acme.com")# OpenAI never sees the real PII
That’s it! The wrapper automatically sanitizes input, calls the LLM with safe text, and rehydrates the response.
from langchain_core.prompts import ChatPromptTemplateprompt = ChatPromptTemplate.from_template("Answer this question: {query}")chain = prompt | safe_llmresult = chain.invoke({"query": "What is John Smith's email?"})