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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: generalanalysis-0.2.3.tar.gz
  • Upload date:
  • Size: 18.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.3.tar.gz
Algorithm Hash digest
SHA256 14c3aaf8c4523522088f149f2b9aa06e9504924fdd495eac9ef4b180cd41a17b
MD5 111fe05a0680e6dcf9e63fbb612ce971
BLAKE2b-256 81fd9e1d4b987aed8bca669082154ec2a9fb0ec91b3a9f185805da345f5c0017

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for generalanalysis-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c6da3676edb88af293c567841c65420a977a8b407a19eb7cb0014108a57653d0
MD5 76b6b6db4ae4ee753700976309bd11ba
BLAKE2b-256 0b193a31dff2a28df115c8f63f7d5974ca11a87460d0d410c9c948dd300cc40d

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