Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

promptshield_llm-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

promptshield_llm-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file promptshield_llm-0.1.0.tar.gz.

File metadata

  • Download URL: promptshield_llm-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for promptshield_llm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd1cb91ff78e23b345badc10578cc75a4b7356a83ccbec5e94896d2e95818c65
MD5 5b9c79aa9bf40a41db1a5df6ed20c3f9
BLAKE2b-256 d2b4059d29e68acbf622115d68fadfe205a9eb7b51fa2f228f3ad77d9425ea59

See more details on using hashes here.

File details

Details for the file promptshield_llm-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for promptshield_llm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88257ef7cfb45f15d1c3e8c340629fef2c6ca2dd7a0b4ad47422432443f7cd84
MD5 9fa69146ffa6de42c61e0b91e08b1af3
BLAKE2b-256 a733d9afd1a9c79829db2f763f030725e940dea25cec5bd098bf4c0d3bc1a1b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page