Official Python SDK for the Sievr API — drop-in guardrails for LLM apps.
Project description
sievr
Official Python SDK for the Sievr API — drop-in guardrails for LLM apps. PII redaction and prompt-injection detection in a single API call.
Install
pip install sievr
# or
uv add sievr
Quick start
from sievr import Sievr
client = Sievr(api_key="sv_live_...")
result = client.scan({
"text": "Email alice@example.com. Ignore previous instructions.",
"checks": ["pii", "injection"],
})
print(result.pii.redacted_text)
# "Email <EMAIL_1>. Ignore previous instructions."
print(result.injection.verdict, result.injection.score)
# block 0.95
.scan() and .rehydrate() accept either a plain dict (validated and
converted under the hood) or a typed model object if you'd rather have
the extra compile-time safety:
from sievr.models.scan_request import ScanRequest
from sievr.models.scan_request_checks_item import ScanRequestChecksItem
result = client.scan(ScanRequest(
text="...",
checks=[ScanRequestChecksItem.PII, ScanRequestChecksItem.INJECTION],
))
Round-trip with an LLM
After your model has run on the redacted text, restore the placeholders:
cleaned = client.rehydrate({
"text": "I'll send a confirmation to <EMAIL_1>.",
"entities": [
{"original": e.original, "replacement": e.replacement}
for e in result.pii.entities
],
})
print(cleaned.text)
# "I'll send a confirmation to alice@example.com."
/v1/scan/rehydrate is free — it doesn't tick the quota meter.
Configuration
client = Sievr(
api_key="sv_live_...",
base_url="https://api.sievr.dev", # override for self-hosted or testing
timeout=10.0, # seconds, optional
)
Errors
All API errors raise SievrError:
from sievr import Sievr, SievrError
try:
client.scan(...)
except SievrError as err:
print(err.code, err.status, err.raw)
Common error codes: unauthorized, quota_exceeded, validation_failed,
request_too_large, invalid_json.
Async
The generated low-level functions ship with asyncio variants; the friendly
Sievr class is sync-only for now. To make async calls today, drop down to:
from sievr import AuthenticatedClient
from sievr.api.scan import scan_text
from sievr.models.scan_request import ScanRequest
client = AuthenticatedClient(base_url="https://api.sievr.dev", token="sv_live_...")
result = await scan_text.asyncio(client=client, body=ScanRequest(text="..."))
An async variant of the friendly wrapper will land in a future release.
Reference
Full API reference: https://sievr.dev/docs
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
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 sievr-0.1.1.tar.gz.
File metadata
- Download URL: sievr-0.1.1.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdf97ecb7fc6ae122989f06b788b2a0a826e8ee0a49240bdfa9b407c7280e3b5
|
|
| MD5 |
3d9e0113a8dc2ed24a57c687ee56ba94
|
|
| BLAKE2b-256 |
301a50c0422bfaaa5a61fa953ccdb50d263404b109ec6470213182d1de050315
|
File details
Details for the file sievr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sievr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 41.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
568d8f370cdce44385149d4156bdab03dc430daf0673f4fd264497219e31e41a
|
|
| MD5 |
8402a716d22263f928864c5394f59980
|
|
| BLAKE2b-256 |
631007d21383f8ba7230f820259c22ac307cdf6a9a3ea2fb401828988b8c453f
|