Skip to main content

piighost

English | Français

CI codecov PyPI version Python versions License: MIT Security: bandit Discord

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 Doe becomes <<PERSON:1>>
  • john.doe@example.com becomes <<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>>.

A user chats with an agent, confidential values are replaced by placeholders before reaching the LLM and restored afterwards for the user and for tool calls.

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

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

If piighost is useful to you, a star on GitHub helps other developers find it.

Metadata

Release files for piighost 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for piighost 2.1.1
File Size Uploaded
piighost-2.1.1.tar.gz 134.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for piighost 2.1.1
File Interpreter ABI Platform
piighost-2.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 317.2 kB

Release files / piighost-2.1.1.tar.gz

Download URL piighost-2.1.1.tar.gz
Size 134.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fd3bff84aeccb36825fe149de698189213353805ba968b18205d7ea72c75fc45
BLAKE2b-256 checksum
How to use checksums
820b949c2c375490c808beda52cbe63508ff486c200e15f4754810ad3c813d9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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.1-py3-none-any.whl

Download URL piighost-2.1.1-py3-none-any.whl
Size 182.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c55f1cabc3526c2a7220e4c8ad15524c319495345a89a51ec0b0c80581068789
BLAKE2b-256 checksum
How to use checksums
938234b00b24ab4b4f678d2c4c0504ff1c87c0219adda937eb25ec0f4e51fd91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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 history Release notifications | RSS feed

This release

2.1.1 This release

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.10.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.14.0

2 release files

0.12.0

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page