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-pubsubpydantic >= 2.6.0
Authors & License
Maintained by the FairOps Open Source team. Licensed under Apache 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1823eb40ab6fcf68b7517bd56d6f3de12b48018cc688d9e63a7cd83a9f9ec80d
|
|
| MD5 |
8f4cfe0ac208a9bc006cb7a4be08f051
|
|
| BLAKE2b-256 |
8c8b6b944b718dbca6fdebd887f35f7ace3f66be90100e4ad846c2f33182dab4
|
Provenance
The following attestation bundles were made for fairops_sdk-0.1.0.tar.gz:
Publisher:
publish-sdk.yml on ayush585/FairOps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fairops_sdk-0.1.0.tar.gz -
Subject digest:
1823eb40ab6fcf68b7517bd56d6f3de12b48018cc688d9e63a7cd83a9f9ec80d - Sigstore transparency entry: 1283458823
- Sigstore integration time:
-
Permalink:
ayush585/FairOps@f7c1acf13983319754a0daab83a167bd364d0044 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ayush585
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@f7c1acf13983319754a0daab83a167bd364d0044 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f05eaa0a37c9cb58e5a33f80a8e2810c46b4295d351552b117896d3287d21a47
|
|
| MD5 |
22433ef51bfceb59efc98f5fe6d4260f
|
|
| BLAKE2b-256 |
cccfae37f54b72e712d7da2f4caa7d1f80920c17b0bc652a3283854eee4d93f6
|
Provenance
The following attestation bundles were made for fairops_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish-sdk.yml on ayush585/FairOps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fairops_sdk-0.1.0-py3-none-any.whl -
Subject digest:
f05eaa0a37c9cb58e5a33f80a8e2810c46b4295d351552b117896d3287d21a47 - Sigstore transparency entry: 1283459002
- Sigstore integration time:
-
Permalink:
ayush585/FairOps@f7c1acf13983319754a0daab83a167bd364d0044 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ayush585
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@f7c1acf13983319754a0daab83a167bd364d0044 -
Trigger Event:
release
-
Statement type: