piighost
English | Français
piighost replaces personal data with placeholders before the LLM sees it, then restores the real values in the reply and in tool calls. This Python library de-identifies confidential data, meaning personal data (PII) and secrets, through a reversible pseudonymization often called anonymization. LangChain, Pydantic AI, LlamaIndex and Claude Code integrations are provided, together with an OpenAI and Anthropic API connector.
This de-identification spots confidential data with pluggable detectors (regex, NER, LLM) and replaces each value with a placeholder, the token that takes its place. For example:
John Doebecomes<<PERSON:1>>john.doe@example.combecomes<<EMAIL:1>>
This placeholder stays the same from one message to the next with the conversational pipeline, which keeps the mapping between a value and its placeholder across the whole conversation. If john.doe@example.com reappears three messages later, the placeholder is still <<EMAIL:1>>, which lets the LLM follow the thread.
The LLM therefore only receives de-identified text. When it returns placeholders, for example by answering Hello <<PERSON:1>>, piighost replaces them with the real values. The user sees John Doe and never sees the de-identification.
The same mechanism protects agents that call tools. With the LangChain middleware, a tool that needs the real email address receives it in clear, while the LLM that supplies it only writes <<EMAIL:1>>.
The LLM only sees placeholders. The tool receives the real address, the user gets a clear-text reply, and your agent code stays the same.
Quickstart
pip install piighost # or: uv add piighost
ExactMatchDetector de-identifies a dictionary of known values, with no model to download.
import asyncio
from piighost.components.detector import ExactMatchDetector
from piighost.pipeline import AnonymizationPipeline
detector = ExactMatchDetector({"John Doe": "PERSON", "john.doe@example.com": "EMAIL"})
pipeline = AnonymizationPipeline(detector)
result = asyncio.run(pipeline.anonymize("Write to John Doe at john.doe@example.com."))
print(result.text) # Write to <<PERSON:1>> at <<EMAIL:1>>.
The Quickstart goes on with a real detector and a conversation.
Go further
- Start: installation, first pipeline, conversational pipeline
- Configure: a pipeline in a TOML file, pattern groups from the catalog, every config key
- Integrate: LangChain, Pydantic AI, LlamaIndex, Claude Code, a remote piighost-api
- Deploy: an API server from a catalog configuration, a production thread pipeline, several instances
- Understand: why de-identify, architecture, security, GDPR compliance, limitations, detection, measured, how it compares
- Upgrade: versions and the move to 2.0
Ecosystem
- piighost.dev: the project website, with the ecosystem and its philosophy
- piighost catalog: reviewed regex groups and ready-made pipeline configurations, pulled by reference
- piighost-api: a server hosting one pipeline behind HTTP, with OpenAI- and Anthropic-compatible proxies
- piighost-chat: an example chat interface with human-in-the-loop
- caviardage: a browser app that redacts a Word deed, with piighost running in Pyodide. Nothing of the document leaves the tab
Project
- Community: Discord to get help, report bugs and request features
- Contributing: contribution guide and bug reports
- License: MIT
If piighost is useful to you, a star on GitHub helps other developers find it.
Metadata
Release files for piighost 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| piighost-2.1.0.tar.gz | 134.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| piighost-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 316.1 kB
Release files / piighost-2.1.0.tar.gz
| Download URL | piighost-2.1.0.tar.gz |
|---|---|
| Size | 134.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ba5eacb6e9167ebff244d48bff5e69d0b54b9621231612977bd5fedae5adb49
|
|
BLAKE2b-256 checksum How to use checksums |
f11f3e5925ac8f697c47d2390402bafb19344a25ee3dd34bd3996a1705ecf942
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / piighost-2.1.0-py3-none-any.whl
| Download URL | piighost-2.1.0-py3-none-any.whl |
|---|---|
| Size | 182.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3e6f6ba8c18a154b92b43408050eeff73f7c447f4f4544cdc1f486006c55643
|
|
BLAKE2b-256 checksum How to use checksums |
588e92959cccf8b8a1908d420f731cb14d759277a7362008a26a616305e669d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|