API reference¶
mllm-shap exposes a small, typed public surface. Import the symbols below
from mllm_shap; the module pages document every class and function where it
is defined.
Public exports¶
The table is generated from mllm_shap.__all__ at build time, so it always lists
what from mllm_shap import ... accepts.
Symbol |
Summary |
|---|---|
Scale attributions by the sum of absolute values. |
|
Generate text through an OpenAI-compatible |
|
Raised when a run archive or its manifest cannot be read or parsed. |
|
Raised when a run archive already exists and |
|
Raised when reanalyze meets an archive of a run that did not finish. |
|
Raised when a run archive lacks its manifest or SQLite database. |
|
Audio content of a message, held in memory or referenced by path. |
|
Raised when a configured generative backend cannot be reached. |
|
Aggregate coalition samples with uniform Banzhaf coalition weights. |
|
Boolean presence mask aligned with a player set. |
|
Sync hooks notified as coalition jobs are planned and finished. |
|
Sample complementary coalition pairs and aggregate CC attributions. |
|
Raised when configuration values are invalid or inconsistent. |
|
Frozen conversation state used as the explainability input. |
|
Player set and reference values for a characteristic function. |
|
Cosine similarity between static or contextual embeddings (U1/U2). |
|
Remove absent players from the rendered conversation. |
|
Value of the coalition left after removing the top- |
|
Supported cooperative-game value formulations. |
|
Similarity |
|
Enumerate all coalitions and delegate attribution to an estimand plugin. |
|
Top-level explain pipeline configuration. |
|
Attribution output for a single explain run. |
|
Explain pipeline output including scheduler metrics. |
|
Run the explain pipeline for a conversation snapshot. |
|
Concrete generation output consumed by built-in value functions. |
|
Return attributions unchanged. |
|
Collect span records in memory for tests and diagnostics. |
|
Attribute |
|
Generate text through a local LM Studio API server. |
|
Score a coalition by the model’s confidence in its own generation. |
|
Raised when a value function needs token logprobs a generation lacks. |
|
Raised when a run manifest or archive uses an unsupported schema version. |
|
One message of a conversation: a role and ordered content parts. |
|
Partition a snapshot into one player per non-empty message. |
|
Min-max scale to |
|
Root of every error raised on purpose by mllm-shap. |
|
Echo text words and answer one token per voiced run of every audio part. |
|
Hash-based generative backend with no external model dependencies. |
|
Sample random coalitions and delegate attribution to an estimand plugin. |
|
Replace absent players with neutral fillers that preserve their width. |
|
Two-phase complementary estimator with Neyman coalition-size allocation. |
|
Protocol for recording explain pipeline stage spans. |
|
Replace absent players with a fixed mask placeholder. |
|
Ordered explainability players aligned with coalition masks. |
|
Where one player sits in the conversation it was partitioned from. |
|
Raised when a plugin name is registered twice without |
|
Inputs a plugin factory receives when the registry builds a plugin. |
|
Entry-point groups registered in packaging metadata. |
|
Raised when a packaging entry point cannot be imported. |
|
Raised when no plugin is registered under the requested group and name. |
|
Register and resolve pipeline plugins by group and name. |
|
Shift to non-negative values, apply a power, then scale to sum one. |
|
Raised when reanalyze settings disagree with the archived run. |
|
Score |
|
Participant role attached to a message or token. |
|
Top-level metadata persisted alongside a run archive. |
|
Make each spellable word of every audio message’s transcript a player. |
|
Aggregate coalition samples with Shapley coalition weights. |
|
Text content of a message. |
|
Score generations with cosine similarity of frozen TF-IDF vectors. |
|
Render attributions as a SHAP-style horizontal bar chart. |
|
Partition a snapshot into whitespace-delimited text tokens. |
|
Render attributions as inline colored tokens. |
|
Generate text with a local Hugging Face language model. |
|
One conversational turn composed of ordered messages. |
|
Configure the |
|
Return a registry with the built-in plugins and third-party entry points. |
|
Score |
|
Display colored token HTML when IPython is available. |
|
Parse YAML text into a validated |
|
Serialize a config to YAML with stable key ordering within sections. |
|
Parse a JSON manifest payload into a run manifest. |
|
Render |
|
Return an HTML fragment for inline token coloring in Jupyter. |
Modules¶
Package-level objects¶
Shapley-value attributions for conversational language models.
@domain core @see [[knowledge/architecture/core]]
- mllm_shap.configure_logging(config_path: Path | str | None = None, level: int | str | None = None, json: bool = False) Path | None[source]¶
Configure the
mllm_shaploggers from TOML or with one stderr handler.Without
levelandjsonthe[tool.logging]section of a TOML file is applied. With either of them and noconfig_path, the package logger gets a single stderr handler instead (replacing earlier handlers) and stops propagating to the root logger (propagate=False), so records are not printed twice by a root handler;configure_logging(level="INFO")shows the pipeline’s stage events.- Parameters:
config_path – TOML file to read. Defaults to
MLLM_SHAP_LOGGING_CONFIGor the nearestpyproject.tomlabove the working directory.level – Level of the
mllm_shaplogger ("INFO",logging.DEBUG…); overrides the TOML level when both are given. Defaults toINFOfor the stderr handler.json – Emit one JSON object per record (
time,level,logger,message) instead of plain lines. Only for the stderr handler.
- Returns:
The TOML file that was read, or
Nonewhen none was (aNullHandleris installed when neither a file norlevel/jsonwas given).- Raises:
ValueError – If
jsonis combined withconfig_path; the TOML file defines its own formatters.