Skip to main content

A privacy-preserving prompt transformation library with smart multiple key combinations that reduce redundancy by 50%+ while maintaining complete accessibility 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. Now with smart combination technology that reduces description length by 50%+ while preserving complete accessibility information.

โœจ Key Features

๐Ÿ”’ Privacy Protection - Removes medical terms while preserving functional needs
๐ŸŽฏ Smart Combinations - Combines multiple accessibility needs into optimized single descriptions
โšก 50%+ More Efficient - Dramatically reduces word count without losing information
๐Ÿง  AI-Ready - Perfect single-string descriptions for prompt engineering
๐Ÿ“š 14 Categories - Comprehensive coverage of disability and accessibility needs

๐ŸŽฏ 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
  • Smart Combining multiple accessibility needs into efficient single descriptions

๐Ÿ”„ 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."

โšก Smart Multiple Keys (v1.2.0)

# Instead of 179 words across 3 separate descriptions...
keys = ["visual-impairment", "hearing-impairment", "physical-disability"]
result = transform_multiple_keys(keys)

# Get 1 optimized 76-word description (57% more efficient!)
print(result['output'])
# "I have comprehensive accessibility needs requiring screen reader 
# compatibility with detailed text descriptions... [complete single description]"

๐Ÿ—๏ธ 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
  • Smart Combination Engine for optimizing multiple accessibility descriptions

๐Ÿ“ฆ Installation

pip install privacy-prompt-library

๐Ÿš€ 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."

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."

Smart Multiple Keys (Most Efficient!)

from prompt_library import transform_multiple_keys

# Get 1 optimized description instead of 3 separate ones
keys = ["visual-impairment", "hearing-impairment", "physical-disability"] 
result = transform_multiple_keys(keys)  # Smart combination by default

print(f"Efficiency: {result['validation']['efficiency_gain']} space saved!")
print(f"Single optimized description:\n{result['output']}")

Library Information

from prompt_library import get_library_info
info = get_library_info()
print(f"Version: {info['version']}")
print(f"Features: {', '.join(info['features'])}")

โญ What's New in v1.2.0: Smart Combination

Transform multiple accessibility needs into one optimized description instead of handling separate strings:

# OLD WAY: Get 3 separate 60-word descriptions (180 words total)
desc1 = transform_by_key("visual-impairment")     # 60 words
desc2 = transform_by_key("hearing-impairment")    # 60 words  
desc3 = transform_by_key("physical-disability")   # 60 words
# Total: 180 words, lots of redundancy

# NEW WAY: Get 1 smart combined description (76 words total)
result = transform_multiple_keys(["visual-impairment", "hearing-impairment", "physical-disability"])
print(f"Efficiency gain: {result['validation']['efficiency_gain']}")  # "57.5%"
print(result['output'])  # One cohesive, optimized description

Benefits:

  • ๐ŸŽฏ 50-60% more efficient - Dramatically reduced word count
  • ๐Ÿ”„ No redundancy - Removes repeated accessibility terminology
  • ๐Ÿ“ Better readability - Flows as one natural description
  • โšก Perfect for AI - Single string ready for prompts

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."


## ๐Ÿ”‘ Key-Based Descriptions
Generate detailed 60-word accessibility descriptions from simple category keys:

```python
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

๐Ÿš€ Why Use Smart Combinations?

Problem: Traditional approach requires handling multiple separate descriptions

# Old way: 3 separate descriptions = 180 words + manual combining
visual_desc = transform_by_key("visual-impairment")      # 60 words
hearing_desc = transform_by_key("hearing-impairment")    # 60 words  
mobility_desc = transform_by_key("physical-disability")  # 60 words
# You have to manually combine and remove redundancy

Solution: Smart combination gives you one optimized description

# New way: 1 smart description = 76 words, ready to use
result = transform_multiple_keys(["visual-impairment", "hearing-impairment", "physical-disability"])
ai_prompt = f"{result['output']} Help me plan a conference presentation."
# 57% more efficient, no redundancy, perfect for AI prompts

๐Ÿ”— Multiple Keys (New in v1.2.0)

Process multiple accessibility categories at once with intelligent combination:

from prompt_library import transform_multiple_keys

# Smart combination (default) - Intelligently merges descriptions, removes redundancy
keys = ["visual-impairment", "hearing-impairment", "physical-disability"]
result = transform_multiple_keys(keys)  # Uses smart_combined by default

print(f"Original total: {sum(result['transformation']['individual_word_counts'])} words")
print(f"Smart combined: {result['transformation']['total_word_count']} words")
print(f"Efficiency gain: {result['validation']['efficiency_gain']}")
print(f"\nCombined description:\n{result['output']}")

# Alternative methods if needed:
separate_result = transform_multiple_keys(keys, combine_method="separate")
simple_combined = transform_multiple_keys(keys, combine_method="simple_combined")
prioritized = transform_multiple_keys(keys, combine_method="prioritized")

Combination Methods:

  • "smart_combined" - Default: Intelligently merges while avoiding redundancy (57% more efficient!)
  • "separate" - Returns individual descriptions for each key
  • "simple_combined" - Basic concatenation of all descriptions
  • "prioritized" - Emphasizes first key, adds others as supplementary needs

Smart Combination Benefits:

  • ๐ŸŽฏ Efficiency: Reduces word count by ~50-60% while preserving all key information
  • ๐Ÿ”„ Deduplication: Removes redundant terms like "accessibility needs" and "screen reader"
  • ๐Ÿ“ Coherence: Creates flowing, natural language instead of repetitive chunks
  • โšก Performance: Single cohesive description instead of multiple separate strings

๐Ÿ’ก 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: Multiple Accessibility Needs

from prompt_library import transform_multiple_keys

# Smart combination automatically optimizes for efficiency
multiple_needs = transform_multiple_keys(
    ["visual-impairment", "physical-disability"]
)
# Result is a single, optimized 58-word description instead of 120 words

ai_prompt = f"{multiple_needs['output']} Help me set up a home office workspace."
print(f"Efficiency: {multiple_needs['validation']['efficiency_gain']} space saved!")

Scenario 3: 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.2.0.tar.gz (92.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.2.0-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: privacy_prompt_library-1.2.0.tar.gz
  • Upload date:
  • Size: 92.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.2.0.tar.gz
Algorithm Hash digest
SHA256 660d3f101010083551f730448e4bf7d6957e5ffb36b9cf7b84ec1fcae45a8521
MD5 c8f93aa2fa6ac799c130d71ce7ac5a6e
BLAKE2b-256 31dd3364142533a8447b2d1e01dd25475d6f700fe250e78127b5cb7cd98d7246

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for privacy_prompt_library-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 486d1e2823cffac706766a74275f81f74451a957527d3e2ea39d746d06f9dbf6
MD5 a3ddda543bf4637b8e91d3fce500184e
BLAKE2b-256 2f84251c4f841050b17fa94fe0abec753b4b9ae076156d78e666360f8325993f

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