A Python SDK for interacting with Guardrails API.
Project description
README for Guardrails SDK
Guardrails SDK
The Guardrails SDK is a Python library designed to facilitate interaction with the Guardrails API. It provides a simple and intuitive interface for developers to integrate safety mechanisms and quality controls into their applications powered by Large Language Models (LLMs).
Features
- Content Validation: Validate user-generated content against specified guardrails to ensure safety and compliance.
- PII Detection & Masking: Automatically detect and mask Personally Identifiable Information (PII) in text to protect user privacy.
- Toxicity Detection: Identify and flag toxic language in user inputs to maintain a safe environment.
Installation
You can install the Guardrails SDK using pip. Run the following command:
pip install guardrails-sdk
Usage
Here’s a quick example of how to use the Guardrails SDK:
from guardrails_sdk.client import GuardrailsClient
client = GuardrailsClient()
# Validate content
toxicity_result = client.validate_content("Your input text here")
print(toxicity_result)
# Mask PII
masked_result = client.mask_pii("Your input text with PII here")
print(masked_result)
# Detect toxicity
toxicity_detection = client.detect_toxicity("Your input text here")
print(toxicity_detection)
API Reference
GuardrailsClient
- validate_content(content: str) -> dict: Validates the provided content against the configured guardrails.
- mask_pii(content: str) -> dict: Masks any detected PII in the provided content.
- detect_toxicity(content: str) -> dict: Detects toxicity in the provided content and returns the results.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.
License
This project is licensed under the terms of the Apache License 2.0. See the LICENSE file for details.
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
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 guardrails_sdk-0.1.0.tar.gz.
File metadata
- Download URL: guardrails_sdk-0.1.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
423884757fdfc237df6d1d213dbb8455e9b9ff4884da20aff4d5edb4a6504c8e
|
|
| MD5 |
8b0e84134158b4fb633fef3f77634887
|
|
| BLAKE2b-256 |
ba60d3e1c8ee0b0b2d8665a920052bb52bd1fcbe6b2ffb380843baa646d55d6a
|
File details
Details for the file guardrails_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: guardrails_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8698a81766b69d9d043d3b2b88bd399fcd19d9d8c17b10297302d44d95cdb53
|
|
| MD5 |
ec6464622bfe5110b9b63a82fd624062
|
|
| BLAKE2b-256 |
4646bffa61edaa0bd169ee2dbc42ab828262baf5fba84bad77f77f701226fa7e
|