SDKs & integrations

LlamaIndex

Reversible PII redaction for LlamaIndex RAG. The question and the retrieved chunks are redacted before the LLM sees them, and the answer comes back with the real values restored. Your index and your citations stay untouched.

Status: built and tested, not yet on PyPI. pip install llama-index-postprocessor-obscate works once the package is published.

Known limitation: partial values come back wrong. If the model quotes only part of a redacted value (“your card ending in 7588”), restore can’t fix it: it matches whole tokens, and a fragment isn’t one. With fpe this fails silently and plausibly: the fake card looks like a real card, so its last four digits look real, and your user sees a confident, wrong statement about their own data. Assistants do this often.

Measured with real Claude (claude-haiku-5-5, 3 runs each, a small test): plain fpe prompt, 2 of 3 replies stated wrong card digits; fpe plus the instruction below, 0 of 3; tokenize, 0 of 3.

For user-facing output, add to your system prompt: “When you mention a card number, email or phone number, repeat it exactly and in full as given. Never abbreviate, mask or quote part of it.” Or use strategy="tokenize": models don’t split [CREDIT_CARD_1]. This is a boundary of any reversible-redaction approach: a fragment of a stand-in can never map back to a fragment of the original.

Quickstart (under 5 minutes)

pip install "llama-index-postprocessor-obscate[examples]"
export OBSCATE_API_KEY=ob_...          # free: 1,000 requests/month at https://obscate.com, no card
export ANTHROPIC_API_KEY=sk-ant-...    # optional: without it the example uses a local stand-in LLM
python examples/quickstart.py

Real output (stand-in LLM, Obscate engine; redacted values differ per key):

1) Your question:
   What does Ravi Kumar want, and what email should we reply to?
2) What the LLM receives:
   Ticket 813: Priya Sharma (mlaem@bskcfsg.org) asked to change her delivery address.
   Ticket 812: [PERSON:wdmvms3g…] (seab.yomog@tziwxuo.com, +91 45671 58378) was charged twice on card 7982 1772 2838 5004 ...
   Query: What does [PERSON:wdmvms3g…] want, and what email should we reply to?
3) Restored answer for your user:
   (stand-in LLM) From the tickets: Ticket 812: Ravi Kumar (ravi.kumar@example.com, +91 98765 43210) was charged twice ...

Look at line 2: “Priya Sharma” was not caught in that sentence, while “Ravi Kumar” was. That is typical: structured IDs are near-perfect, names and places are best-effort. Test on your own data.

One step: wrap your query engine

from llama_index.postprocessor.obscate import ObscateQueryEngine

qe = ObscateQueryEngine.wrap(index.as_query_engine(llm=llm))   # strategy="fpe" by default
print(qe.query("What did Ravi Kumar ask about?"))              # answer restored

Or build it from parts with ObscateQueryEngine.from_args(retriever, llm=llm, strategy="tokenize"). Retrieval runs on the original query against your own index; only the synthesis LLM sees redacted text. The query and all chunks go in one Obscate request, so tokens are consistent between the question and the chunks.

Node postprocessor

from llama_index.postprocessor.obscate import ObscatePostprocessor

obscate = ObscatePostprocessor()                       # fpe: restore needs no state
qe = index.as_query_engine(llm=llm, node_postprocessors=[obscate])
answer = obscate.restore(qe.query("Summarise ticket 812"))

A postprocessor can’t change the question text, which still reaches the LLM unredacted; use ObscateQueryEngine when questions contain PII. String metadata the LLM would see (for example author) is redacted too; keys in excluded_llm_metadata_keys are not sent at all.

What it does not cover

  • Embeddings: your embedding model sees raw text when you index and query. If it is a remote API, use a local embedding model or redact documents before indexing.
  • Streaming: answers are read to completion and then restored.
  • LlamaIndex’s own DEBUG logs: llama_index.core.indices.utils logs retrieved chunk text at DEBUG level, upstream of this package. Keep the llama_index logger at INFO or above in production.
  • Cost: 1 Obscate request per query; restores are free. Fails closed: if Obscate errors, the LLM is not called.
  • Verified against the hosted API with real Claude (claude-haiku-5-5): the query engine, the postprocessor and the quickstart all restore correctly. With llama-index-llms-anthropic 0.13.0, use anthropic<2 (the [examples] extra pins it); on anthropic 2.x that package fails and LlamaIndex reports “Empty Response”.

Get a free API key

Free plan: 1,000 requests a month, all strategies. Your key is shown once — we store only a hash of it.

Prefer the terminal?
curl -s API/v1/signup \
  -H 'content-type: application/json' \
  -d '{"email":"you@company.com"}'

Contact

Our contact address is being set up.