Skip to main content

A privacy-preserving prompt transformation library that redacts disability mentions while maintaining functional context

Project description

Privacy-Preserving Prompt Library

A comprehensive Python library that transforms user prompts to protect disability privacy while maintaining functional context for AI interactions.

🎯 Purpose

This library helps users interact with AI models without disclosing specific medical conditions by:

  • Detecting disability mentions in prompts
  • Redacting medical/diagnostic terms
  • Adding functional context for better AI responses
  • Preserving user privacy and intent

🔄 How It Works

Input: "I'm paralyzed and need help finding accessible restaurants"
↓
Output: "I use mobility equipment and need help finding accessible restaurants. I need step-free access to buildings and accessible parking close to entrances."

🏗️ Architecture

  • 14 Disability Categories with comprehensive subgroups
  • Pattern Detection Engine for identifying disability mentions
  • Redaction Engine for replacing medical terms
  • Context Enrichment for adding functional needs
  • Privacy Validation to ensure no medical data leaks

� Installation

pip install privacy-prompt-library

�🚀 Quick Start

Python API

from prompt_library import transform_prompt

# Transform a single prompt
result = transform_prompt("I'm blind and need coding help")
print(result['output'])
# "I use screen readers and need coding help. Please ensure any visual content includes text descriptions and is compatible with screen readers."

# Get library information
from prompt_library import get_library_info
info = get_library_info()
print(f"Library version: {info['version']}")

Command Line Interface

# Transform a prompt via CLI
privacy-prompt "I have ADHD and need focus strategies"

# Get library information
privacy-prompt --info

# Custom privacy level
privacy-prompt --privacy-level medium "Your prompt here"

Async Support

from prompt_library import PromptLibrary

library = PromptLibrary()
await library.initialize()
result = await library.transform_prompt("I'm autistic and need help with social situations")
print(result['output'])

📋 Categories Supported

  1. Physical Disabilities
  2. Visual Impairments
  3. Hearing Impairments
  4. Speech & Language
  5. Intellectual Disabilities
  6. Learning Disabilities
  7. Autism Spectrum
  8. Developmental Disabilities
  9. Mental Health
  10. Emotional & Behavioral
  11. Invisible Disabilities
  12. Multiple Disabilities
  13. Neurological
  14. Genetic & Rare Disorders

🔒 Privacy Guarantee

  • ✅ No medical terms in output
  • ✅ No diagnostic language
  • ✅ Functional descriptions only
  • ✅ Complete user anonymity

🐍 Python Package Features

This repository now includes a fully-featured Python package with:

  • Modern Packaging: Uses pyproject.toml and is available on PyPI
  • Async Support: Full async/await compatibility
  • CLI Tool: Command-line interface for easy integration
  • Type Hints: Complete typing for better development experience
  • Testing: Comprehensive test suite with pytest

Python Installation & Usage

# Install from PyPI
pip install privacy-prompt-library

# Basic usage
python -c "from prompt_library import transform_prompt; print(transform_prompt('I have autism and need help'))"

# CLI usage
privacy-prompt --info
privacy-prompt "I'm deaf and need communication help"

Development Setup

# Clone repository
git clone https://github.com/git-markkuria/kanuni-layer-sdk.git
cd kanuni-layer-sdk

# Install in development mode
pip install -e .

# Run tests
pytest tests/

📁 Repository Structure

├── prompt_library/          # Python package
│   ├── core/               # Core processing engines
│   ├── engines/            # Context and redaction engines
│   ├── data/               # JSON data files
│   └── cli.py              # Command-line interface
├── src/                    # JavaScript/Node.js version
├── tests/                  # Python tests
├── pyproject.toml          # Python packaging config
└── package.json            # Node.js config

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

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

privacy_prompt_library-1.0.2.tar.gz (71.1 kB view details)

Uploaded Source

Built Distribution

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

privacy_prompt_library-1.0.2-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file privacy_prompt_library-1.0.2.tar.gz.

File metadata

  • Download URL: privacy_prompt_library-1.0.2.tar.gz
  • Upload date:
  • Size: 71.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for privacy_prompt_library-1.0.2.tar.gz
Algorithm Hash digest
SHA256 9a8848425f9fdbef0437a335d7ab8f90ee313f05f678e0b8ee756d6fe14d55f0
MD5 5594b57d8def3b78ca10e69e43eafb2c
BLAKE2b-256 b71b128fedcfb326c2daeca1bb5806ac63a883935a22a98cba69c80564addcfc

See more details on using hashes here.

File details

Details for the file privacy_prompt_library-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for privacy_prompt_library-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a93670584bbbc0effde3192e96b175f77418a730d2ea8a123345d3be69d5dfb9
MD5 516c166dce15ceaf074ec81029fed667
BLAKE2b-256 7f086744733216e4e635ad59b47a7ba176581665887bdf25c309c91aa3711363

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