Skip to main content

Python SDK for the AmbientMeta Privacy Gateway — sanitize PII before LLM calls

Project description

ambientmeta

Python SDK for the AmbientMeta Privacy Gateway — strip PII before sending text to any LLM, restore it after.

Install

pip install ambientmeta

Usage

from ambientmeta import AmbientMeta

client = AmbientMeta(api_key="your-api-key")

# 1. Sanitize — strip PII before the LLM call
result = client.sanitize("Email John Smith at john@acme.com about the merger")

print(result.sanitized)
# "Email [PERSON_1] at [EMAIL_1] about the merger"

# 2. Send sanitized text to any LLM
llm_response = your_llm.complete(result.sanitized)

# 3. Rehydrate — restore PII after the LLM responds
restored = client.rehydrate(text=llm_response, session_id=result.session_id)
print(restored.text)
# Original PII restored in the LLM's response

Async

from ambientmeta import AsyncAmbientMeta

async with AsyncAmbientMeta(api_key="your-api-key") as client:
    result = await client.sanitize("Email John Smith at john@acme.com")
    restored = await client.rehydrate(text=llm_response, session_id=result.session_id)

Error handling

from ambientmeta import AmbientMetaError, AuthenticationError, RateLimitError

try:
    result = client.sanitize("text")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Too many requests — wait and retry")
except AmbientMetaError as e:
    print(f"API error: {e.code}{e.message}")

Links

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

ambientmeta-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ambientmeta-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file ambientmeta-0.1.0.tar.gz.

File metadata

  • Download URL: ambientmeta-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ambientmeta-0.1.0.tar.gz
Algorithm Hash digest
SHA256 62c9cf43ed2d44f86cc6943c4b6db0f64be56f19a920d45a2ffa0f3c7f6d8e36
MD5 0c2e671127908115d971fa874468e046
BLAKE2b-256 b722a194e845cd62cb1fadb8c5cadb0225bb6fc35a758d750e73028848c11f8a

See more details on using hashes here.

File details

Details for the file ambientmeta-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ambientmeta-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ambientmeta-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e71cb0d3d52d78178ce80592c29e646e08e6f8846974733684180db94f9d0332
MD5 af7ff142ebef4e377f44ad76943682cf
BLAKE2b-256 d75a52d30bd5298c49ca6ffd0f738b778c6b46c274be9013b9106649577bfdf8

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