Skip to main content

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
        ])

License

MIT

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

generalanalysis-0.2.1.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

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

generalanalysis-0.2.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file generalanalysis-0.2.1.tar.gz.

File metadata

  • Download URL: generalanalysis-0.2.1.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for generalanalysis-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e9ebcfbca5cba19e6d0f46153f7b5f66a8e79f55edec86a3503e4cd294a138ee
MD5 49953b81f0872eb68ceb79071a1f1e59
BLAKE2b-256 1a7bf138affccbb8595830acb2e2881693b36f3d681cf838b35af06f53a2151b

See more details on using hashes here.

File details

Details for the file generalanalysis-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for generalanalysis-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 288e9e0ed527ec5beb9d786be064851c10fd62042cc8154ddada975d463984e0
MD5 72eec932185bdc344b53f7b8658d14ff
BLAKE2b-256 74f223f653592f03984d2fa5c7f6fbc1ca0b9e60fb6441541a407c9ced4f944d

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