fabricatio_character.utils

Utilities for character cards.

Functions

dump_card(→ str)

Dump character cards.

top_with_confidence(...)

Return (top_distortion, confidence_score). None if all zero.

is_high_confidence(→ bool)

Check if confidence score exceeds the CBT threshold from config.

Module Contents

fabricatio_character.utils.dump_card(*card: fabricatio_character.models.character.CharacterCard) str

Dump character cards.

fabricatio_character.utils.top_with_confidence(scores: dict[str, float]) tuple[fabricatio_character.models.mental.Distortion | None, float]

Return (top_distortion, confidence_score). None if all zero.

Parameters:

scores – Dict with Distortion enum value strings as keys, scores as values.

Returns:

Tuple of (top distortion or None, confidence score).

fabricatio_character.utils.is_high_confidence(confidence: float) bool

Check if confidence score exceeds the CBT threshold from config.