Skip to main content

A privacy-preserving prompt transformation library that redacts disability mentions while maintaining functional context. Now includes key-based disability descriptions with improved documentation and usage examples.

Project description

Privacy-Preserving Prompt Librar## ๐Ÿš€ Quick Start

Basic Usage - Transform Personal Prompts

from prompt_library import transform_prompt

# Protect your privacy while getting AI help
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."

New Feature - Key-Based Descriptions

from prompt_library import transform_by_key, get_supported_keys

# See what accessibility categories are available
print("Available categories:", get_supported_keys())

# Get a detailed 60-word accessibility description
description = transform_by_key("visual-impairment")  
print(description['output'])
# Returns comprehensive visual accessibility needs without medical terms

# Use in your AI prompts
ai_prompt = f"{description['output']} Help me learn web development."

Library Information

from prompt_library import get_library_info
info = get_library_info()
print(f"Version: {info['version']}")
print(f"Features: {', '.join(info['features'])}")
```sive 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

```bash
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)

Generate detailed 60-word accessibility descriptions from simple category keys:

from prompt_library import transform_by_key, get_supported_keys

# Get all available category keys
supported_keys = get_supported_keys()
print("Available keys:", supported_keys)

# Generate a functional description from a key
description = transform_by_key("visual-impairment")
print(description['output'])
# Output: "I have specific visual accessibility needs requiring comprehensive 
# screen reader compatibility, high contrast display options with customizable 
# color schemes, detailed text descriptions for all visual content including 
# images, alternative format documents in accessible formats, large print 
# materials when needed, audio descriptions for multimedia content, tactile 
# feedback options, keyboard navigation support, and accessible navigation 
# systems that work seamlessly with assistive technology."

# Example usage for different needs:
mobility_desc = transform_by_key("physical-disability")
hearing_desc = transform_by_key("hearing-impairment")
speech_desc = transform_by_key("speech-language-communication-and-swallowing-disability")

print(f"Word count: {len(mobility_desc['output'].split())} words")  # Always 60 words

Available Keys:

  • visual-impairment - Visual accessibility needs and assistive technology
  • hearing-impairment - Hearing accessibility and communication needs
  • physical-disability - Mobility and physical accessibility requirements
  • speech-language-communication-and-swallowing-disability - Communication support needs
  • speech-intellectual-autism-spectrum-disorders - Cognitive and sensory support
  • maxillofacial-disabilities - Facial and oral function considerations
  • progressive-chronic-disorders - Adaptive and flexible accommodation needs

๐Ÿ’ก Usage Examples

Scenario 1: Getting a Functional Description for AI Prompts

from prompt_library import transform_by_key

# Instead of saying "I'm blind", use a functional description
visual_needs = transform_by_key("visual-impairment")
prompt = f"{visual_needs['output']} Can you help me learn Python programming?"

# This gives the AI detailed context about your accessibility needs
# without revealing medical information

Scenario 2: Building Accessibility Profiles

# Create comprehensive accessibility descriptions
keys = ["visual-impairment", "hearing-impairment", "physical-disability"]
accessibility_profile = []

for key in keys:
    description = transform_by_key(key)
    accessibility_profile.append(description['output'])

combined_profile = " ".join(accessibility_profile)
print(f"Complete accessibility profile: {combined_profile}")

Scenario 3: Privacy-Safe Prompt Enhancement

# Transform personal prompts to be privacy-safe
personal_prompt = "I have multiple sclerosis and need help with work accommodations"
safe_prompt = transform_prompt(personal_prompt)

print("Original:", personal_prompt)
print("Safe version:", safe_prompt['output'])
# Result protects medical info while preserving functional needs

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.1.tar.gz (86.5 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.1-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: privacy_prompt_library-1.1.1.tar.gz
  • Upload date:
  • Size: 86.5 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.1.tar.gz
Algorithm Hash digest
SHA256 83252daad2c62298cdc29eac3d7ad3fecf03756bfe513e3e4780409dad478980
MD5 9f787022c420e7455552c648dbd82907
BLAKE2b-256 6a61a97c48d288a1dfd8e27533e2d9c82d3f11253f7a304fc23ae1d0f9987ba3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for privacy_prompt_library-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75d3728c1ec55daef49496d0a026d9f2edb6d2703d7732b422882501d2e72536
MD5 22fed42d3142f961a277a1ad4c3242db
BLAKE2b-256 cc06603476b35b111615d0e1e414c56460ec17e64ebf087772f6689932b90f60

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