Python SDK for General Analysis Guardrails
Project description
General Analysis SDK
Python SDK for General Analysis AI Guardrails.
Installation
pip install generalanalysis
Quick Start
import generalanalysis
# Uses GA_API_KEY env var by default
client = generalanalysis.Client()
# Check text against guard policies
result = client.guards.invoke(guard_id=1, text="Text to check")
if result.block:
print("Blocked:", [p.name for p in result.policies if not p.passed])
API Reference
Guards Operations
# List guards
guards = client.guards.list()
# Get guard details
guard = client.guards.get(guard_id=1)
# Invoke guard
result = client.guards.invoke(guard_id=1, text="...")
print(f"Blocked: {result.block}, Latency: {result.latency_ms}ms")
# Generate policies from job
policies = client.guards.generate_policies_from_job(job_id=123)
# Get logs (paginated)
logs = client.guards.list_logs(guard_id=1, page=1, page_size=50)
Async Support
import asyncio
import generalanalysis
async def main():
async with generalanalysis.AsyncClient() as client:
results = await asyncio.gather(*[
client.guards.invoke(guard_id=1, text=t)
for t in texts
])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
generalanalysis-0.2.5.tar.gz
(19.1 kB
view details)
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 generalanalysis-0.2.5.tar.gz.
File metadata
- Download URL: generalanalysis-0.2.5.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d5f8dfa99630f91c79237df0f5e4e07beb083cb1df643229d1e2670b42a800d
|
|
| MD5 |
2bb858ef7c4af44f3c7f9c52c6cac87d
|
|
| BLAKE2b-256 |
f37a9562c9eae84bac8845dc3abce79a1511b0245ea05301cd7a3d641d1b4d3e
|
File details
Details for the file generalanalysis-0.2.5-py3-none-any.whl.
File metadata
- Download URL: generalanalysis-0.2.5-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a9e3cf1f73bddd7d319255585956f2bf40559bfe94fe1da5d11ce1e3917a76d
|
|
| MD5 |
7718ee7dd21d241295faa50678ded76f
|
|
| BLAKE2b-256 |
1f659e559f9e3bd272b6f8da022bfacd10cd342bd15fab452da4381b89ff63ce
|