Catalog PyPI
Back to packageRELEASE DETAILS

0.1.2

PyPI

aiblackbox

Plug-and-play AI/ML function call logging with replay and patching

Published14 Aug 2025
Direct dependencies0
Transitive dependenciesNot calculated

README

Version 0.1.2 documentation

AiBlackBox

AiBlackBox is a universal logging and auditing system for AI and machine learning models. It acts like a “flight recorder” for AI, capturing inputs, outputs, parameters, and metadata of all monitored functions, objects, or classes. Designed for transparency, reproducibility, and debugging, it ensures that AI models are traceable, auditable, and compliant with ethical standards.

Features

Automatic logging of AI model actions Capture all inputs, outputs, parameters, and metadata in real-time.

Function, object, class, and module patching Easily patch functions or entire modules to track behavior without modifying your original code.

Flexible backends Use in-memory logging for testing or connect to persistent storage backends for long-term auditing.

Serialization-safe Handles complex objects safely with customizable serializers.

Replay and audit Inspect recorded actions to debug, audit, or verify model behavior.

Supports AI frameworks out-of-the-box Designed to work with PyTorch, TensorFlow, scikit-learn, and other AI pipelines.

Installation

Install from PyPI:

pip install aiblackbox

For testing purposes, you can use TestPyPI:

pip install --index-url https://test.pypi.org/simple/ aiblackbox

Quick Start from aiblackbox import BlackBox

Initialize the BlackBox

bb = BlackBox()

Log a simple event

bb.log('prediction', {'input': [1,2,3], 'output': 0.95})

Replay logs

for entry in bb.replay(): print(entry)

Public API

The following functions and classes are available for advanced usage:

from aiblackbox import *

Function & object patching

patch_function patch_object patch_module patch_class apply_generic_patches auto_patch_ai_functions

Logging and backends

set_log_backend get_memory_backend LogBackend MemoryBackend

Serialization & safe logging

safe_serialize register_custom_serializer set_max_depth get_and_clear_fallback_logs

Unpatching

unpatch_object unpatch_all

Example: Patching a Function from aiblackbox import BlackBox, patch_function

def my_ai_model(x): return x**2

bb = BlackBox() patched_model = patch_function(my_ai_model, bb.log)

Call patched function

result = patched_model(5)

Replay logs

for entry in bb.replay(): print(entry)

Contributing

Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.

License

Distributed under the MIT License. See LICENSE for details.

About

AI Ethics Institute — Our mission is to provide tools for AI transparency, auditability, and accountability, helping organizations build ethical AI systems.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

2 collected
aiblackbox-0.1.2-py3-none-any.whl

bdist_wheel · 16.62 KB · Python py3

Source file
aiblackbox-0.1.2.tar.gz

sdist · 19.73 KB · Python source

Source file

Repository

PENDING
yourusername/aiblackbox

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:01 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:0d5fe99ad689f1d60e7b4e24bd7ee4c49dd9395ad6c600b5cb744392ea2d848a

Other collected versions

View all collected versions →