Skip to main content

A privacy-preserving prompt transformation library that redacts disability mentions while maintaining functional context. Now includes key-based disability descriptions.

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']}")

🔑 Key-Based Descriptions (New in v1.1.0)

Transform predefined disability category keys into 60-word functional descriptions:

from prompt_library import transform_by_key, get_supported_keys

# Get all supported keys
keys = get_supported_keys()
print(keys)
# ['visual-impairment', 'hearing-impairment', 'physical-disability', ...]

# Transform a key into a functional description
result = transform_by_key("visual-impairment")
print(result['output'])
# "I have specific visual accessibility needs requiring comprehensive screen reader compatibility..."

# Supported keys:
# - visual-impairment
# - hearing-impairment  
# - physical-disability
# - speech-language-communication-and-swallowing-disability
# - speech-intellectual-autism-spectrum-disorders
# - maxillofacial-disabilities
# - progressive-chronic-disorders

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.1.0.tar.gz (84.9 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.1.0-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: privacy_prompt_library-1.1.0.tar.gz
  • Upload date:
  • Size: 84.9 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.1.0.tar.gz
Algorithm Hash digest
SHA256 07de1f33a642ff9946dc3c9ac1999a84abb76e5a2fb26248bf7715fcc43339c8
MD5 62fff60620a6eaf936e297aa195cf2da
BLAKE2b-256 8971158036b81c6a3232f52a46ed86b36a4cf236b5c6bcb279ee041b724a36c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for privacy_prompt_library-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aff67b86e85084a7c1a4c7947f245b78883d0c61ea5b3235cc8fe011fbd3fad0
MD5 2c126b4b8cfdc7127e86a61436d10512
BLAKE2b-256 fca5348cb6a234896243676a82b0c47149284f1de6dbc3254008a4ed800e38a1

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