SDK Reference

Complete API surface for the inferpathio Python package. For quickstart usage, see the Quickstart guide.

ifp.init()

Initialize the SDK for a process. Must be called before any other SDK method.

ifp.init(
    api_key: str,
    # Optional: override API base URL (for on-prem deployments)
    base_url: str = "https://api.inferpathio.com/v1"
)

ifp.ModelTracker

The primary class for continuous drift monitoring and governance event creation.

tracker = ifp.ModelTracker(
    model_id: str,
    policy: str,       # policy name registered in dashboard
    version: str = None # optional version tag
)

# Log a prediction batch for drift monitoring
tracker.log_prediction_batch(
    features: pd.DataFrame | np.ndarray,
    labels: pd.Series | np.ndarray,
    threshold: float = 0.1,
    metric: str = "psi"  # "psi" | "kl" | "wasserstein"
)

ifp.governance_run()

Context manager for attaching governance metadata to a model training or promotion run.

with ifp.governance_run(
    model_id: str,
    metadata: dict = None  # custom key-value tags
) as run:
    run.log_model(model: Any, flavor: str)
    run.set_policy(policy_name: str)
    run.tag(key: str, value: str)
    run.log_metric(name: str, value: float)
    run.promote(environment: str)  # triggers approval workflow

Supported model flavors

  • 'sklearn' — scikit-learn Pipeline or estimator
  • 'xgboost' — XGBoost Booster
  • 'lightgbm' — LightGBM Booster
  • 'pytorch' — PyTorch nn.Module
  • 'tensorflow' — Keras/TF SavedModel
  • 'mlflow' — MLflow logged model URI
  • 'custom' — any callable with predict()