Skip to main content

ML model monitoring + LLM observability — one decorator, live drift detection, AI diagnosis, token cost tracking

Project description

modelpulse-sdk

ML model monitoring for developers. One decorator. Live drift detection, AI diagnosis, and instant alerts — in 60 seconds.

PyPI version Python License: MIT


What is ModelPulse?

ModelPulse monitors your ML models in production. It detects when your model's input data starts looking different from what it was trained on (data drift), generates AI-powered plain-English explanations of what changed, and fires Slack/email alerts — automatically.

No MLOps team required. No schema design. No enterprise sales call.


Installation

pip install modelpulse-sdk

Quickstart

import modelpulse

# Initialize once at startup
modelpulse.init(
    api_key="mp_live_xxxx",       # from dashboard → model → API Keys
    model_id="your-model-uuid",   # from dashboard
)

# Wrap your predict function with one decorator
@modelpulse.monitor
def predict(features: dict):
    return my_model.predict([features])[0]

# That's it — ModelPulse logs every prediction automatically
result = predict({"age": 34, "income": 72000, "tenure_months": 12})

ModelPulse will:

  • Log every prediction (inputs, outputs, confidence, latency)
  • Compute drift hourly against your baseline distribution
  • Generate an AI diagnosis when drift is detected
  • Fire Slack/email alerts with the diagnosis included

How it works

1. Batching

Predictions are queued in memory and flushed every 10 seconds or when 50 accumulate — whichever comes first. This means zero blocking on your model's critical path.

2. Non-blocking

The SDK uses a background thread. Your predict() function adds less than 1ms overhead.

3. Resilient

Network failures are silently dropped. The SDK never raises an exception that could crash your application.


Advanced usage

Return confidence scores

@modelpulse.monitor
def predict(features: dict):
    probs = model.predict_proba([features])[0]
    # Return (prediction, confidence) tuple
    return probs.argmax(), float(probs.max())

Custom API URL (self-hosted)

modelpulse.init(
    api_key="mp_live_xxxx",
    model_id="your-model-uuid",
    api_url="https://your-own-api.com/api/v1",
)

Works with any framework

# scikit-learn
@modelpulse.monitor
def predict(features):
    return sklearn_model.predict([list(features.values())])[0]

# XGBoost
@modelpulse.monitor
def predict(features):
    dmatrix = xgb.DMatrix([list(features.values())])
    return float(xgb_model.predict(dmatrix)[0])

# PyTorch
@modelpulse.monitor
def predict(features):
    tensor = torch.tensor(list(features.values()))
    return torch_model(tensor).item()

Drift Detection

ModelPulse uses two statistical tests under the hood:

Test What it measures
PSI (Population Stability Index) Magnitude of distribution shift
KS Test (Kolmogorov-Smirnov) Whether two distributions are different
PSI Score Health Status
< 0.10 🟢 Healthy — no significant drift
0.10 – 0.20 🟡 Warning — moderate drift
> 0.20 🔴 Critical — significant drift

You never need to configure these thresholds manually — ModelPulse computes them automatically from your first 100 predictions.


Dashboard

After integrating the SDK, view your model's health at:

👉 https://frontend-ruddy-sigma-92.vercel.app

The dashboard shows:

  • Feature drift scores with visual progress bars
  • AI-generated plain-English diagnosis (powered by Claude)
  • Prediction volume and latency trends
  • Alert history

Configuration options

modelpulse.init(
    api_key="mp_live_xxxx",      # required — your API key
    model_id="uuid",             # required — your model ID
    api_url="https://...",       # optional — default: ModelPulse cloud
    timeout=5,                   # optional — HTTP timeout in seconds
    batch_size=50,               # optional — flush after N predictions
    async_mode=True,             # optional — fire-and-forget mode
)

Links


License

MIT License — see LICENSE for details.


Built by Saxon Preetham · Visakhapatnam, India · 2026

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

modelpulse_sdk-0.2.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

modelpulse_sdk-0.2.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file modelpulse_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: modelpulse_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for modelpulse_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 363148e659d90b35bd9513bf7528472472429b60019b35f72bcc51c12a007517
MD5 c865a11d954be90a00701045bd03730b
BLAKE2b-256 02caf5ee8698845d0a66e7e5604beb920b7c6cd05cbbbe23305a1ff71aca1199

See more details on using hashes here.

File details

Details for the file modelpulse_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: modelpulse_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for modelpulse_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 719aa2dc4efa5213170d441604ad0dfed80381a2595420497cc2e93af07ae824
MD5 5a1e83ca6dc14ce719232920356bccd7
BLAKE2b-256 851e13fec6d5393ef1fa7d4c10d08e03744998628219812290cee472ab9220c2

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