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

Uploaded Python 3

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

Hashes for generalanalysis-0.2.5.tar.gz
Algorithm Hash digest
SHA256 6d5f8dfa99630f91c79237df0f5e4e07beb083cb1df643229d1e2670b42a800d
MD5 2bb858ef7c4af44f3c7f9c52c6cac87d
BLAKE2b-256 f37a9562c9eae84bac8845dc3abce79a1511b0245ea05301cd7a3d641d1b4d3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for generalanalysis-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9a9e3cf1f73bddd7d319255585956f2bf40559bfe94fe1da5d11ce1e3917a76d
MD5 7718ee7dd21d241295faa50678ded76f
BLAKE2b-256 1f659e559f9e3bd272b6f8da022bfacd10cd342bd15fab452da4381b89ff63ce

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