Skip to main content

Python SDK for the Gibs multi-regulation compliance API

Project description

Gibs Python SDK

Official Python SDK for the Gibs multi-regulation compliance API. Classify AI system risk levels, check regulatory obligations, and get answers to compliance questions -- all with source citations to EU legislation.

Installation

pip install gibs

Quick Start

from gibs import GibsClient

client = GibsClient(api_key="gbs_live_xxx")

# Classify an AI system's risk level
result = client.classify("Facial recognition system for airport security")
print(result.risk_level)   # "high"
print(result.confidence)   # 0.92
print(result.obligations)  # [Obligation(id="ob_001", ...)]

# Ask a compliance question
answer = client.check("What are the transparency obligations for chatbots?")
print(answer.answer)
print(answer.sources)      # [SourceCitation(article_id="art_50", ...)]

Async Support

from gibs import AsyncGibsClient

client = AsyncGibsClient(api_key="gbs_live_xxx")

result = await client.classify("CV screening tool for recruitment")
answer = await client.check("Does GDPR apply to employee monitoring?")

# Use as async context manager
async with AsyncGibsClient(api_key="gbs_live_xxx") as client:
    result = await client.classify("...")

Authentication

Get your API key at gibs.dev. Pass it directly or set the GIBS_API_KEY environment variable:

export GIBS_API_KEY=gbs_live_xxx
# Reads from GIBS_API_KEY automatically
client = GibsClient()

API Reference

client.classify(description, **kwargs)

Classify an AI system's risk level under EU regulation.

result = client.classify(
    "Emotion detection system for job interviews",
    data_types=["biometric", "behavioral"],
    decision_scope="employment",
    sector="recruitment",
    jurisdiction="EU",
)

print(result.risk_level)      # "prohibited" | "high" | "limited" | "minimal"
print(result.confidence)      # 0.0 - 1.0
print(result.reasoning)       # Detailed explanation
print(result.obligations)     # List of compliance obligations
print(result.sources)         # Source citations to legislation
print(result.corpus_version)  # Version of the legal corpus used

client.check(question, **kwargs)

Ask a compliance question and get an answer with citations.

answer = client.check(
    "What data protection impact assessment is required for high-risk AI?",
    regulation="both",  # "ai_act", "gdpr", or "both"
    system_context={"type": "recommendation engine", "sector": "healthcare"},
)

print(answer.answer)            # Detailed answer
print(answer.confidence)        # "high" | "medium" | "low"
print(answer.sources)           # Source citations
print(answer.should_abstain)    # True if out of scope

client.health()

Check API health status.

health = client.health()
print(health.status)       # "healthy"
print(health.components)   # {"qdrant": "ok", "postgres": "ok", ...}

Account Management

# List API keys
keys = client.list_keys()

# Create a new key
new_key = client.create_key("CI Pipeline")
print(new_key.api_key)  # Full key shown once

# Revoke a key
client.delete_key(key_id=2)

Error Handling

from gibs import GibsClient, GibsAuthError, GibsRateLimitError, GibsAPIError

client = GibsClient(api_key="gbs_live_xxx")

try:
    result = client.classify("...")
except GibsAuthError:
    print("Invalid API key")
except GibsRateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except GibsAPIError as e:
    print(f"API error {e.status_code}: {e.message}")

The SDK automatically retries on rate limits and transient network errors with exponential backoff (3 retries by default).

Configuration

client = GibsClient(
    api_key="gbs_live_xxx",          # Required (or set GIBS_API_KEY env var)
    base_url="https://api.gibs.dev", # Default
    timeout=120.0,                    # Seconds (default: 120)
    max_retries=3,                    # Retry count (default: 3)
)

Requirements

Links

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

gibs-0.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

gibs-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file gibs-0.1.0.tar.gz.

File metadata

  • Download URL: gibs-0.1.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for gibs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3870588a38c38412c0b75b121f0760acb411c8ec077d0ed4757bf6d3372ff274
MD5 f223e2f9308c617d3df40f3c03b1367f
BLAKE2b-256 153ec6520f54621029243f06f19b129b9759bc293ef72512dd8457418e812366

See more details on using hashes here.

File details

Details for the file gibs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gibs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for gibs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12572a0eee3215e695fc2c3156e1e543d21fbcfa1226049e20fde9186cd441df
MD5 7cb06eb4aaeb2800f124c22ab59fe987
BLAKE2b-256 e3819dfb411a4fbc3d6605c2e7d15b94541e356c37460d85eeacac547e2809c6

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