Metadata-Version: 2.4
Name: glasslm
Version: 0.1.0
Summary: Privacy guardrail for AI applications — mask PII before it reaches any LLM
Author-email: GlassLM <glasslm@gmail.com>
License: MIT License
        
        Copyright (c) 2026 GlassLM
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/AkshaySasi/GlassLM
Project-URL: Repository, https://github.com/AkshaySasi/GlassLM
Project-URL: Issues, https://github.com/AkshaySasi/GlassLM/issues
Keywords: pii,masking,privacy,llm,ai,security,nlp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# glasslm

**Privacy guardrail for AI applications.** Mask sensitive data before sending to any LLM, restore it from the response.

## Install

```bash
pip install glasslm
```

## Usage

### Basic Masking

```python
from glasslm import mask, unmask

# Mask PII from text
result = mask("Email me at user@example.com, my key is sk-abc123xyz789")

print(result.masked_text)
# "Email me at [[EMAIL_1]], my key is [[API_KEY_1]]"

print(result.masked_items)
# [MaskedItem(id='email_1', original='user@example.com', ...)]

# Restore the original from a response
response = "I'll contact [[EMAIL_1]] about the [[API_KEY_1]] integration."
restored = unmask(response, result.masked_items)
print(restored)
# "I'll contact user@example.com about the sk-abc123xyz789 integration."
```

### With an LLM (OpenAI example)

```python
from glasslm import mask, unmask
import openai

client = openai.OpenAI(api_key="your-openai-key")

user_input = "My API key is sk-abc123... please help me debug."

# 1. Mask
result = mask(user_input)

# 2. Send masked text to LLM
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": result.masked_text}]
)

raw_reply = response.choices[0].message.content

# 3. Restore
final_reply = unmask(raw_reply, result.masked_items)
print(final_reply)
```

## What gets detected

| Type | Examples |
|------|---------|
| `api_key` | `sk-...`, `pk-...`, OpenAI/Anthropic keys |
| `email` | `user@example.com` |
| `phone` | `+1 (555) 123-4567` |
| `ssn` | `123-45-6789` |
| `credit_card` | `4111 1111 1111 1111` (Luhn validated) |
| `access_token` | JWT, Bearer tokens |
| `private_key` | PEM-encoded RSA keys |
| `cloud_credential` | AWS Access Keys (`AKIA...`) |
| `database_url` | `mongodb://...`, `postgresql://...` |
| `ip_address` | IPv4 and IPv6 |
| `name` | `John Smith` (context-aware) |

## License

MIT
