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 technologyhearing-impairment- Hearing accessibility and communication needsphysical-disability- Mobility and physical accessibility requirementsspeech-language-communication-and-swallowing-disability- Communication support needsspeech-intellectual-autism-spectrum-disorders- Cognitive and sensory supportmaxillofacial-disabilities- Facial and oral function considerationsprogressive-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
- Physical Disabilities
- Visual Impairments
- Hearing Impairments
- Speech & Language
- Intellectual Disabilities
- Learning Disabilities
- Autism Spectrum
- Developmental Disabilities
- Mental Health
- Emotional & Behavioral
- Invisible Disabilities
- Multiple Disabilities
- Neurological
- 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.tomland 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
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83252daad2c62298cdc29eac3d7ad3fecf03756bfe513e3e4780409dad478980
|
|
| MD5 |
9f787022c420e7455552c648dbd82907
|
|
| BLAKE2b-256 |
6a61a97c48d288a1dfd8e27533e2d9c82d3f11253f7a304fc23ae1d0f9987ba3
|
File details
Details for the file privacy_prompt_library-1.1.1-py3-none-any.whl.
File metadata
- Download URL: privacy_prompt_library-1.1.1-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75d3728c1ec55daef49496d0a026d9f2edb6d2703d7732b422882501d2e72536
|
|
| MD5 |
22fed42d3142f961a277a1ad4c3242db
|
|
| BLAKE2b-256 |
cc06603476b35b111615d0e1e414c56460ec17e64ebf087772f6689932b90f60
|