semvec/pypi-packages huggingface dataset:
aiblackbox 0.1.2
Plug-and-play AI/ML function call logging with replay and patching
License: MIT
Requires Python: >=3.8

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.
aind-metadata-validator 0.11.5
Generated from aind-library-template
License: MIT
Requires Python: >=3.7

# aind-metadata-validator

This package includes helper functions for validating metadata from `aind-data-schema`, individual files in a metadata.json file, and the fields within each file.

All validation returns a `MetadataState` enum, see `utils.py`

## Get status

### By ID

Use aind-data-access-api [todo]

### Full table

You can get the entire redshift status table by running:

```
from aind_data_access_api.rds_tables import RDSCredentials
from aind_data_access_api.rds_tables import Client
import pandas as pd

DEV_OR_PROD = "dev" if "test" in API_GATEWAY_HOST else "prod"
REDSHIFT_SECRETS = f"/aind/{DEV_OR_PROD}/redshift/credentials/readwrite"
RDS_TABLE_NAME = f"metadata_status_{DEV_OR_PROD}"

rds_client = Client(
        credentials=RDSCredentials(
            aws_secrets_name=REDSHIFT_SECRETS
        ),
    )

class MetadataState(int, Enum):
    VALID = 2  # validates as it's class
    PRESENT = 1  # present
    OPTIONAL = 0  # missing, but it's optional
    MISSING = -1  # missing, and it's required
    EXCLUDED = -2  # excluded for all modalities in the metadata
    CORRUPT = -3  # corrupt, can't be loaded from json


def _get_status() -> pd.DataFrame:
    """Get the status of the metadata
    """
    response = rds_client.read_table(RDS_TABLE_NAME)

    # returns int values, can be compared against MetadataState
    return response
```

## Metadata validation

Returns a dictionary where each key is `metadata`, a `file`, or a `file.field` and the value is the `MetadataState`.

```
from aind_metadata_validator.metadata_validator import validate_metadata

m = Metadata()

results_df = validate_metadata(m.model_dump())
```

## Redshift sync

### Run on Code Ocean

Two code ocean capsules run the sync nightly: https://codeocean.allenneuraldynamics.org/capsule/0257223/tree and https://codeocean.allenneuraldynamics-test.org/capsule/3640490/tree

### Run locally

The package also includes a function `run()` in `sync.py` that will validate the entire DocDB and push the results to redshift.

`pip install aind-metadata-validator`

```
from aind_metadata_validator.sync import run

run()
```
bookio-fetchfox 6.0.2
Collection of API services to fetch information from several blockchains.
License: MIT
Requires Python: <4.0,>=3.9
Keywords: book.io, stuff.io, blockchain, crypto, algorand, cardano, coinbase, ethereum, polygon

# book.io / fetchfox

> Collection of API services to fetch information from several blockchains.

![algorand](https://s2.coinmarketcap.com/static/img/coins/64x64/4030.png)
![cardano](https://s2.coinmarketcap.com/static/img/coins/64x64/2010.png)
![coinbase](https://s2.coinmarketcap.com/static/img/coins/64x64/27716.png)
![ethereum](https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png)
![polygon](https://s2.coinmarketcap.com/static/img/coins/64x64/3890.png)


## Supported Blockchains

### Algorand

```python
import os
from fetchfox.blockchains import Algorand

algorand = Algorand()

# Brave New World
creator_address = "6WII6ES4H6UW7G7T7RJX63CUNPKJEPEGQ3PTYVVU3JHJ652W34GCJV5OVY"

for asset in algorand.get_collection_assets(collection_id=creator_address):
    print(asset)
```


### Cardano

```python
import os
from fetchfox.blockchains import Cardano

gomaestroorg_api_key = os.getenv("GOMAESTROORG_API_KEY")

cardano = Cardano(
    gomaestroorg_api_key=gomaestroorg_api_key,
)

# Gutenberg Bible
policy_id = "477cec772adb1466b301fb8161f505aa66ed1ee8d69d3e7984256a43"

for asset in cardano.get_collection_assets(collection_id=policy_id):
    print(asset)
```

#### API Keys

* [**gomaestro.org**](https://www.gomaestro.org/pricing)


### EVM (Coinbase, Ethereum and Polygon)

```python
import os
from fetchfox.blockchains import Coinbase, Ethereum, Polygon

moralisio_api_key = os.getenv("MORALIS_API_KEY")
openseaio_api_key = os.getenv("OPENSEA_API_KEY")


# Coinbase
coinbase = Coinbase(
    moralisio_api_key=moralisio_api_key,
    openseaio_api_key=openseaio_api_key,
)

# Artificial Intelligence for Dummies
contract_address = "0x8c1f34bcb76449cebf042cfe8293cd8265ae6802"

for asset in coinbase.get_collection_assets(collection_id=contract_address):
    print(asset)


# Ethereum
ethereum = Ethereum(
    moralisio_api_key=moralisio_api_key,
    openseaio_api_key=openseaio_api_key,
)

# Alice in Wonderland
contract_address = "0x919da7fef646226f88f70305201de392ff365059"

for asset in ethereum.get_collection_assets(collection_id=contract_address):
    print(asset)


# Polygon
polygon = Polygon(
    moralisio_api_key=moralisio_api_key,
    openseaio_api_key=openseaio_api_key,
)

# Art of War
contract_address = "0xb56010e0500e4f163758881603b8083996ae47ec"

for asset in polygon.get_collection_assets(collection_id=contract_address):
    print(asset)
```

#### API Keys

* [**moralis.io**](https://moralis.io/pricing)
* [**opensea.io**](https://docs.opensea.io/reference/api-keys)

---

![fetch, the fox](https://i.imgur.com/fm6mqzS.png)