Skip to main content

A SDK for Kanuni

Project description

Kanuni SDK

Installation

Repository: https://github.com/git-markkuria/kanuni-layer-sdk

Overview

The Kanuni Layer SDK provides utilities to validate and redact sensitive information from user prompts before they are sent to downstream services (for example, LLMs). It offers a small, easy-to-integrate API for prompt validation and redaction.

Key features:

  • Prompt validation
  • Sensitive data redaction (emails, SSNs, credit cards, phone numbers, etc.)
  • Single-call integration

Installation

Install from PyPI:

pip install kanuni-layer-sdk

Install from GitHub (latest source):

pip install git+https://github.com/git-markkuria/kanuni-layer-sdk.git

Install locally for development:

git clone https://github.com/git-markkuria/kanuni-layer-sdk.git
cd kanuni-layer-sdk
python -m pip install -e .

Quick start

The package exposes a convenient function reduct(prompt: str, opted_in: bool = True) -> str that validates and redacts sensitive content.

Example usage:

from kanuni_layer_sdk import reduct

prompt = (
	"My name is John Doe, SSN 123-45-6789, email john.doe@example.com. "
	"Please give me directions to the nearest pharmacy."
)

# Redact using default settings (opted_in=True)
redacted = reduct(prompt)
print("Redacted prompt:\n", redacted)

# Force opt-out (no redaction) if you need the raw prompt
raw = reduct(prompt, opted_in=False)
print("Raw prompt (opted out):\n", raw)

Notes:

  • reduct performs basic prompt validation, optionally applies a transformation step (if configured), and then redacts sensitive values. The function returns the transformed/redacted prompt as a string.
  • Check kanuni_layer_sdk/main.py and the kanuni_layer_sdk/modules package for implementation details.

Development

  • Package code lives under the kanuni_layer_sdk package. The primary entrypoint is kanuni_layer_sdk.reduct.
  • See requirements.txt for runtime dependencies.

Contributing

Issues and pull requests are welcome. Please open PRs against the repository linked above.

License

See PKG-INFO or the repository for license details.

pip install kanuni-layer-sdk

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

kanuni_layer_sdk-0.1.9.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

kanuni_layer_sdk-0.1.9-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file kanuni_layer_sdk-0.1.9.tar.gz.

File metadata

  • Download URL: kanuni_layer_sdk-0.1.9.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for kanuni_layer_sdk-0.1.9.tar.gz
Algorithm Hash digest
SHA256 1afea6eb625d5f590f47621c3eb890b52fb05ac81e3f7a4de14259c7ef15f1e8
MD5 81d06382379393880cce4cb6242075b2
BLAKE2b-256 09d72be754737ff00af1a42790f7710a0b2a1f14c2442ff9362fca53f31ed273

See more details on using hashes here.

File details

Details for the file kanuni_layer_sdk-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for kanuni_layer_sdk-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 74b5532e46c5849b061b55bcdfb32faadf6bbcd4729a14465b46a29bc218427c
MD5 2dc6464c4047d6b3817269ffc19a8d74
BLAKE2b-256 ffbf349eeb0dd86ecd04bc31586f7268e03195ab2608b0c053a84f4ac189510e

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