Domain types¶
Conversation and explanation enumerations for the text MVP.
- class nlp_shap.domain.enums.Role(*values)[source]¶
Bases:
StrEnumParticipant role attached to a message or token.
- USER = 'user'¶
End-user or human-provided input.
- ASSISTANT = 'assistant'¶
Model-generated output.
- SYSTEM = 'system'¶
System-level instruction or steering text.
- class nlp_shap.domain.enums.SystemRolesSetup(*values)[source]¶
Bases:
StrEnumHow system-role tokens participate in explainability.
- NONE = 'none'¶
All tokens, including system tokens, are explainable.
- SYSTEM = 'system'¶
System tokens are excluded from explainability.
- SYSTEM_ASSISTANT = 'system_assistant'¶
System and assistant tokens are excluded from explainability.
- class nlp_shap.domain.enums.EmbeddingMode(*values)[source]¶
Bases:
StrEnumWhether value functions use static or contextual embeddings.
- STATIC = 'static'¶
Embeddings computed from final generated tokens only.
- CONTEXTUAL = 'contextual'¶
Embeddings derived from model internal states.
Immutable conversation snapshots without backend or IO.
- class nlp_shap.domain.conversation.Message(role: Role, text: str)[source]¶
Bases:
objectA single explainable text unit with an attached role.
- class nlp_shap.domain.conversation.Turn(messages: tuple[Message, ...])[source]¶
Bases:
objectOne conversational turn composed of ordered messages.
- class nlp_shap.domain.conversation.ConversationSnapshot(turns: tuple[Turn, ...], snapshot_id: str)[source]¶
Bases:
objectFrozen conversation state used as the explainability input.
- classmethod from_turns(turns: tuple[Turn, ...]) ConversationSnapshot[source]¶
Build a snapshot with a stable content-derived identifier.
Player indexing for cooperative-game explainability.
- class nlp_shap.domain.players.PlayerSet(player_ids: tuple[str, ...])[source]¶
Bases:
objectOrdered explainability players aligned with coalition masks.
Coalition masks over explainability players.
- class nlp_shap.domain.coalition.CoalitionMask(present: tuple[bool, ...])[source]¶
Bases:
objectBoolean presence mask aligned with a player set.
- classmethod from_sequence(present: Sequence[bool]) CoalitionMask[source]¶
Build a mask from any boolean sequence.
Cooperative-game domain types.
- class nlp_shap.domain.game.CooperativeGame(player_set: PlayerSet, empty_value: float = 0.0)[source]¶
Bases:
objectPlayer set and reference values for a characteristic function.
Estimand labels for attribution outputs and archive manifests.
- nlp_shap.domain.estimands.EstimandWire¶
Wire values used in manifests and configuration payloads.
alias of
Literal[‘shapley’, ‘banzhaf’]