Skip to main content

Unified multimodal explainability and responsible AI framework

Project description

(BETA) Bitspect — xai-rai

Model-agnostic XAI + RAI middleware layer for Python | Bitstek.io

Multi-modal Explainable and Responsible AI Python package — v0.1.4

A modular Python SDK for Explainable AI (XAI) and Responsible AI (RAI), combining model explainability, trust diagnostics, and multi-modal routing in a unified framework.

PyPI package name: xai-rai


Description

Python SDK for modular explainable and responsible AI: model adapters, explainers, risk diagnostics, and multi-modal routing in one framework.


Developer

Developed and maintained by @8bitjawad


Overview

xai-rai provides a structured framework for building, testing, and extending explainability and responsible AI workflows.

Instead of using isolated tools for explanations, fairness checks, and robustness analysis, the SDK unifies them under a layered architecture.

It provides:

  • Explainability algorithms (SHAP, LIME, counterfactuals, etc.)
  • Responsible AI diagnostics (bias, drift, robustness)
  • Pluggable model adapters for multiple modalities
  • Routing and orchestration across components
  • Visualization and reporting support

Supported modalities:

  • Tabular models
  • NLP
  • Vision models
  • LLMs
  • Text-to-image (TTI) models

Why xai-rai instead of individual libraries?

Libraries like SHAP or LIME solve explanation problems individually.

xai-rai aims to provide:

  • A unified SDK abstraction
  • Explainability and responsible AI in one system
  • Multi-modal support via adapters
  • Routing logic across models and modalities
  • An extensible architecture for research and deployment
  • LLM explanations for ease of understanding

Architecture

xai-rai follows a layered, result-centric architecture:

Facade
  ↓
Pipeline
  ↓
Analyzers / Explainers
  ↓
Inference Engines / Adapters
  ↓
Unified Result Objects
  ↓
Charts / Reports / UI

Core features

Explainability

  • SHAP feature attribution
  • LIME local explanations
  • Counterfactual explanations
  • Natural language narratives
  • Multi-modal explanation pipelines

Responsible AI

  • Fairness diagnostics
  • Population Stability Index (PSI) drift detection
  • Robustness checks
  • Confidence and anomaly scoring

Installation

Base

pip install xai-rai

Optional extras

pip install xai-rai[tabular]
pip install xai-rai[tti]
pip install xai-rai[vision]
pip install xai-rai[nlp]
pip install xai-rai[llm]
pip install xai-rai[full]

Quickstart — Text-to-Image XAI

from PIL import Image

from xai_rai import TextToImageExplainer

explainer = TextToImageExplainer(
    device="cpu",
    enable_caption_analysis=True,
)

image = Image.open("generated.png")

result = explainer.explain(
    image=image,
    prompt="a futuristic cyberpunk city",
)

print(result.summary())

See demo_tests/ and tti_demo.py for runnable examples.


Public APIs

from xai_rai import (
    TabularExplainer,
    VisionExplainer,
    NLPExplainer,
    LLMExplainer,
    TextToImageExplainer,
)

Design philosophy

Modular architecture

Each concern lives in its own layer.

Adapter pattern

Models are accessed through standardized interfaces.

Separation of concerns

Explainability and responsible AI diagnostics are distinct modules.

Extensibility

New modalities, explainers, diagnostics, and visualization layers can be added without changing the whole system.


Roadmap

Current

  • Tabular explainability
  • NLP explainability
  • Vision explainability
  • LLM explainability
  • Text-to-image explainability
  • SHAP / LIME integration
  • Counterfactual explanations
  • Multi-modal result objects
  • RAI diagnostics
  • Trust and alignment analysis

Example use cases

xai-rai can support:

  • Explainable healthcare models
  • Explainable and responsible AI for businesses
  • Responsible AI and toxicity screens

Contributing

See CONTRIBUTING.md.

This project is in beta. If you wish to contribute:

  • Keep modules modular and loosely coupled
  • Follow the layered architecture
  • Add type hints where possible
  • Prefer result-centric APIs over raw dictionaries
  • Include lightweight tests for new features
  • Keep public APIs clean and stable

For major architectural changes or new modality integrations, open an issue or discussion first.


License

MIT — see LICENSE.

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

xai_rai-0.1.5.tar.gz (134.0 kB view details)

Uploaded Source

Built Distribution

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

xai_rai-0.1.5-py3-none-any.whl (151.9 kB view details)

Uploaded Python 3

File details

Details for the file xai_rai-0.1.5.tar.gz.

File metadata

  • Download URL: xai_rai-0.1.5.tar.gz
  • Upload date:
  • Size: 134.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for xai_rai-0.1.5.tar.gz
Algorithm Hash digest
SHA256 dbd46b1022c6def8a37a84c1ec14159642880ea505f339d1b2f86a62b7d5843b
MD5 7149afea1ddca9c9286036a3e1e22c54
BLAKE2b-256 955b6f1fb158bd5e1899d674d0e693673aebd03d553e96aa210b674f8dc0dcf0

See more details on using hashes here.

File details

Details for the file xai_rai-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: xai_rai-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 151.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for xai_rai-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ed8fa7c9a1a3e4257569c6cbd2723b4d5d3fb642f9416546b55419711f1365ed
MD5 d2decb686d7281778b8701075d5aba3b
BLAKE2b-256 0f5877df5eea490642e3e3618bb638f08e14bfbb8d4458fced898e3cd0f32b0d

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