Skip to main content

FairOps SDK — 3-line ML bias monitoring integration

Project description

FairOps SDK

FairOps SDK is the standalone client library for integrating machine learning prediction streams into the FairOps compliance pipeline. It enables real-time transmission of prediction events, probabilities, ground truths, and sensitive demographic cuts seamlessly to Google BigQuery and the FairOps Engine.

Installation

You can install the SDK via pip:

pip install fairops-sdk

Quick Start

Integrating your model takes literally 3 lines of code:

from fairops_sdk import FairOpsClient

# 1. Initialize mapping your GCP tracking configurations
client = FairOpsClient(
    project_id="your-gcp-project-id",
    # topic_id="fairops-predictions" # Uses default if omitted
)

# 2. Extract your features / scores
features = {"income": 45000, "credit": "Good"}
demographics = {"race": "White", "sex": "Female"}

# 3. Stream the prediction to the Auditor Pipeline
client.log_prediction(
    model_id="credit-risk-v1",
    prediction_label=1,
    prediction_score=0.88,
    features=features,
    demographic_tags=demographics,
    ground_truth=1  # Optional: Log if doing delayed ground-truth syncing
)

Why FairOps?

The fairops-sdk is an asynchronous, non-blocking telemetry client. When you call log_prediction, the payload is aggressively validated using PyDantic schemas before being offloaded to a background thread to prevent any latency injection on your actual API inference gateways.

It handles network retries, connection backoffs, and strict typing automatically.

Requirements

  • Python 3.11+
  • google-cloud-pubsub
  • pydantic >= 2.6.0

Authors & License

Maintained by the FairOps Open Source team. Licensed under Apache 2.0.

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

fairops_sdk-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

fairops_sdk-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fairops_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fairops_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1823eb40ab6fcf68b7517bd56d6f3de12b48018cc688d9e63a7cd83a9f9ec80d
MD5 8f4cfe0ac208a9bc006cb7a4be08f051
BLAKE2b-256 8c8b6b944b718dbca6fdebd887f35f7ace3f66be90100e4ad846c2f33182dab4

See more details on using hashes here.

Provenance

The following attestation bundles were made for fairops_sdk-0.1.0.tar.gz:

Publisher: publish-sdk.yml on ayush585/FairOps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: fairops_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fairops_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f05eaa0a37c9cb58e5a33f80a8e2810c46b4295d351552b117896d3287d21a47
MD5 22433ef51bfceb59efc98f5fe6d4260f
BLAKE2b-256 cccfae37f54b72e712d7da2f4caa7d1f80920c17b0bc652a3283854eee4d93f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for fairops_sdk-0.1.0-py3-none-any.whl:

Publisher: publish-sdk.yml on ayush585/FairOps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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