Skip to main content

Official Python SDK for the Ylemis Trust Platform: PII Shield, Injection Guard, GroundCheck — one client, one integration.

Project description

ylemis — Python SDK for the Ylemis Trust Platform

One integration for all Ylemis guardrails: PII Shield (India-tuned PII detection/redaction, 98.68% F1, 0% false positives on the published benchmark), Injection Guard, and GroundCheck. Zero dependencies — stdlib only.

pip install ylemis

30-second DPDP fix

You're piping customer data into an LLM. Aadhaar/PAN in a third-party model's logs is a ₹250-crore DPDP exposure. One line stops it at the door:

from ylemis import TrustEngine

engine = TrustEngine(keys={"pii-shield": "sk_live_..."})

safe_prompt = engine.check_input(user_text).redacted_text   # PII never leaves your app
llm_response = call_your_llm(safe_prompt)

The two hooks (full flow)

Guardrails belong at two points in the LLM lifecycle — before the prompt goes out, and after the answer comes back:

engine = TrustEngine(api_key="sk_live_...")    # one key everywhere (or keys={...} per product)

inp = engine.check_input(prompt)                # PII + injection, PRE-LLM
if inp.decision == "block":
    ...                                         # your policy
response = call_your_llm(inp.redacted_text)

out = engine.check_output(response, docs=retrieved_docs)   # PII + groundedness, POST-LLM
if out.decision == "allow":
    return response

engine.scan(prompt=..., response=..., docs=...) is batch/audit sugar over both hooks.

Error handling — errors are honest

The API never masks infra errors as billing errors. The SDK encodes that contract as types:

from ylemis import QuotaExceeded, RateLimited, ServiceBusy, InvalidAPIKey

try:
    r = engine.pii.scan(text)
except QuotaExceeded:   # 402 — genuinely out of quota, upgrade or wait for reset
    ...
except RateLimited:     # 429 — slow down (see .retry_after)
    ...
except ServiceBusy:     # 503 — transient; SDK already auto-retried per Retry-After
    ...

Requests are metered only on success — a ServiceBusy retry never double-bills.

Per-product access

engine.pii.scan(text, redaction_mode="mask")   # mask | replace | drop | hash
engine.pii.redact(text)
engine.pii.usage()
engine.injection.score(text)
engine.groundcheck.check(response, source=[...])
engine.health()                                # no-auth liveness, all three services

Products without a configured key are skipped by check_* (listed in report.skipped) and raise MissingKey if called directly — so a PII-only key works fine today.

Development status

All three adapters are exact, verified against the deployed services (2026-07-05), including a live end-to-end run with a single key across all three products.

python -m unittest discover -s tests -v    # offline, no keys needed

The SDK is MIT-licensed client code. API access requires a Ylemis subscription and key from ylemis.com.

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

ylemis-0.1.1.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

ylemis-0.1.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file ylemis-0.1.1.tar.gz.

File metadata

  • Download URL: ylemis-0.1.1.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for ylemis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 864b23768e81613f9ddd2feb6769a5ddf01e57dc98d812cc6a00fea1688e9ff4
MD5 0b22a6d3bfbaa341b93ae1eebaf7e710
BLAKE2b-256 0195fa735f171c22782808c050c4ee42cec8ea925d1120f0619b994d33d1c6ef

See more details on using hashes here.

File details

Details for the file ylemis-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ylemis-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for ylemis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4847ca32bc94464c27c2847a43a2196df4eccc67904e05706f7f21ed826ac1ff
MD5 d99f1dd64419e98dd3e66c51b4292363
BLAKE2b-256 ecb4e97013df14d37ddc011d188c45315a4e99887c940cfa7d81b07ce08a3caa

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