Skip to main content

CloudEvents-first Python SDK for the Open Safety Signal Protocol (OSSP).

Project description

OSSP Python SDK (Reference)

CloudEvents-first client for emitting OSSP events.

Install

pip install ossp-sdk

Quick Start

from ossp_sdk.client import OSSPClient

client = OSSPClient(
    source_uri="urn:example:app:chatbot-prod",
    collector_endpoint=None  # If None, events are logged locally
)

event = client.emit(
    event_type="ai.safety.guardrail.interaction",
    resource={"model_id": "gpt-4o", "environment": "production"},
    data={"action_taken": "block", "reason": "PII detected", "severity": "high"},
    subject="urn:model:gpt-4o"
)
print(event)

CLI Example

You can emit the sample event directly from the repository:

python sdk-python/examples/send_event.py --print

Use --collector-endpoint (and optional --auth-token) to forward the CloudEvent to a collector, and --log-level to adjust verbosity.

Validation (optional)

pip install "ossp-sdk[validate]"

Set the OSSP_VALIDATE environment variable and point OSSP_SCHEMA_DIR to the spec repository path schema/v1.0.0 to validate payloads locally.

If offline, pre-load draft 2020-12 metaschema or vendor the metas under specification/schema/meta/2020-12/.

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

ossp_sdk-0.1.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

ossp_sdk-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ossp_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bbc5a79442b70bba286807a06aa529e4f4e2a9f388a5c76f69f6f6748dbe6086
MD5 fa82154e5a77481abe03fda1022f0053
BLAKE2b-256 2148459bd96ab36c16ed582a9780d3f2d8853c347ddc99669caec68fb60eb406

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ossp_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f84df1fff38a3478e2ba4afedb6d7963a6cd9ebb0849912da7071825bf220547
MD5 e2d4caafe7375d273343a3e643a89a9a
BLAKE2b-256 92cb021f42c522ebf348fd81f459412a07833d59068aa02c2b7cb04eec52e0cc

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