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.7.tar.gz (8.8 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.7-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kanuni_layer_sdk-0.1.7.tar.gz
  • Upload date:
  • Size: 8.8 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.7.tar.gz
Algorithm Hash digest
SHA256 7ca95dae8d96f6d21b0d349aff65e85cb407e72cd74ba625bfa49e57d0fc5cf8
MD5 601a315ac44123afade98301f56f3bc9
BLAKE2b-256 bcde1f2f44611b301828254170fdcfb639ba84a1e2e45d02896c272e34136608

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kanuni_layer_sdk-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 00b3121213d64dd7576320bfb198d370a74ac74e8b14ee77942708c20fb299b9
MD5 2eb4fe8e45b83a4f22d420fd5e9bdfe0
BLAKE2b-256 c4347d4995eefc03395c6964fda5a26a892c0087de3ef25e178b911333cbd88a

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