LlamaIndex Integration
Build compliant RAG pipelines without exposing PII.
Install
pip install llama-index-ambientmeta
Quick Start
from llama_index.core import VectorStoreIndex, Settings from llama_index.llms.openai import OpenAI from llama_index_ambientmeta import PrivacyLLM # Wrap your LLM with privacy protection Settings.llm = PrivacyLLM( llm=OpenAI(), ambientmeta_api_key="am_live_xxx" ) # Build your index as normal index = VectorStoreIndex.from_documents(documents) query_engine = index.as_query_engine() # Queries are automatically sanitized response = query_engine.query("What's in John Smith's contract?") # LLM never sees real names
How It Works
- Your query is sanitized before processing
- RAG retrieval happens with sanitized text
- The LLM generates a response with placeholders
- Response is rehydrated with original entities
With Chat Engine
chat_engine = index.as_chat_engine() # Multi-turn conversations stay private response = chat_engine.chat("Tell me about employee EMP-123456") response = chat_engine.chat("What's their email?")
Configuration
Settings.llm = PrivacyLLM(
llm=OpenAI(model="gpt-4"),
ambientmeta_api_key="am_live_xxx",
entities=["PERSON", "EMAIL", "SSN"], # Optional
custom_patterns=True
)
With Any LLM
Works with any LlamaIndex-supported LLM:
from llama_index.llms.anthropic import Anthropic Settings.llm = PrivacyLLM( llm=Anthropic(model="claude-sonnet-4-20250514"), ambientmeta_api_key="am_live_xxx" )