Python Usage
Basic Usage
Here's how to use the ts-guard Python SDK:
from ts_guard import Guard
guard = Guard(api_key="your-api-key")
response = guard.validate("Hello, world!")
if not response.is_valid:
print("Blocked:", response.reasons)
else:
print("Safe")Each result contains:
blocked: booleanreasons: list of triggered scannersconfidence: float value
You can also load settings from YAML:
guard = Guard.from_yaml(".ts-guard.yaml")