Metadata-Version: 2.4
Name: whiteout-ai
Version: 0.1.3
Summary: Whiteout AI Governance SDK — wrap AI API calls with policy enforcement
Project-URL: Homepage, https://whiteout.groovysec.com
Project-URL: Documentation, https://docs.whiteout.groovysec.com/sdk/python
Project-URL: Repository, https://github.com/groovysec/whiteout-ai-python
Author-email: Groovy Security <engineering@groovysec.com>
License-Expression: Apache-2.0
Requires-Python: >=3.9
Requires-Dist: httpx>=0.25.0
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.20.0; extra == 'anthropic'
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == 'openai'
Description-Content-Type: text/markdown

# Whiteout AI Governance SDK

Wrap AI API calls with Whiteout policy enforcement. Three lines of code to add governance to any Python AI application.

## Install

```bash
pip install whiteout-ai
```

## Quick Start

```python
from whiteout_ai import WhiteoutGuard

guard = WhiteoutGuard(
    token="whiteout_enroll_...",
    backend_url="https://your-org.api.whiteout.groovysec.com",
)

# Option 1: Evaluate a prompt directly
result = guard.evaluate(
    prompt="Summarize this patient record...",
    ai_provider="openai",
    model="gpt-4o",
)
# result = {"decision": "block", "reason": "Contains PHI", ...}

# Option 2: Wrap an OpenAI call
import openai
response = guard.wrap(
    openai.chat.completions.create,
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello world"}],
)

# Option 3: Catch blocked prompts
from whiteout_ai import WhiteoutBlockedError
try:
    guard.evaluate(prompt="SSN 123-45-6789")
except WhiteoutBlockedError as e:
    print(f"Blocked: {e.reason}")
    print(f"Policies: {e.violated_policies}")
```

## Configuration

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `token` | Yes | - | Enrollment token from Whiteout admin |
| `backend_url` | Yes | - | Your org's Whiteout API URL |
| `fail_open` | No | `True` | Allow calls when backend unreachable |
| `timeout` | No | `10.0` | Backend call timeout (seconds) |
| `mode` | No | `sdk` | Deployment mode identifier |

## Features

- Automatic provider detection (OpenAI, Anthropic, Google, Mistral)
- Fast checks cached locally (provider block, model allowlist)
- Remote compliance evaluation for content policies
- Output governance (response scanning in background)
- Fail-open by default (never breaks your app)
- Thread-safe
