Skip to main content

promptshield-llm

PyPI License: MPL-2.0

Redact sensitive data from LLM prompts before sending them to a model.

Installation

pip install promptshield-llm

Usage

from promptshield import shield_prompt

prompt = "Summarize this email from eduardo@example.com. Token: Bearer abc123456789"
safe_prompt = shield_prompt(prompt)

print(safe_prompt)

Output

Summarize this email from [EMAIL]. Token: [TOKEN]

Find sensitive data

from promptshield import find_sensitive

matches = find_sensitive("Contact me at eduardo@example.com")
print(matches)

Custom patterns

from promptshield import shield_prompt

safe = shield_prompt(
    "Customer ID: CUST-12345",
    custom_patterns={"customer_id": r"CUST-\d+"}
)

print(safe)

Overview

promptshield-llm is a tiny Python utility for masking sensitive values in prompts, logs, and LLM inputs.

It is useful when building:

  • LLM applications
  • RAG pipelines
  • AI agents
  • prompt logging systems
  • internal AI tools

Features

  • Redacts emails
  • Redacts phone numbers
  • Redacts API keys and tokens
  • Redacts sensitive URLs
  • Supports custom regex patterns
  • Uses the Python standard library
  • Simple API

Limitations

promptshield-llm is regex-based and may not catch every possible secret or personal identifier. Use it as an extra safety layer, not as your only security control.

Issues

Report issues at: https://github.com/edujbarrios/promptshield-llm

Author

Eduardo J. Barrios edujbarrios@outlook.com

License

Mozilla Public License 2.0

Release files for promptshield-llm 0.1.0

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

Source distribution (sdist)

Source distribution for promptshield-llm 0.1.0
File Size Uploaded
promptshield_llm-0.1.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for promptshield-llm 0.1.0
File Interpreter ABI Platform
promptshield_llm-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / promptshield_llm-0.1.0.tar.gz

Download URL promptshield_llm-0.1.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bd1cb91ff78e23b345badc10578cc75a4b7356a83ccbec5e94896d2e95818c65
BLAKE2b-256 checksum
How to use checksums
d2b4059d29e68acbf622115d68fadfe205a9eb7b51fa2f228f3ad77d9425ea59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / promptshield_llm-0.1.0-py3-none-any.whl

Download URL promptshield_llm-0.1.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88257ef7cfb45f15d1c3e8c340629fef2c6ca2dd7a0b4ad47422432443f7cd84
BLAKE2b-256 checksum
How to use checksums
a733d9afd1a9c79829db2f763f030725e940dea25cec5bd098bf4c0d3bc1a1b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

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