r/madeinpython • • 1h ago

[Python] eq-layer: tone control as explicit states you can print, assert and route on

Repo: https://github.com/Furox-Art/eq-layer - 0.2.6.

"Be more empathetic" is a style instruction, and the failure is structural: you get the same flat warmth for a mild annoyance and for someone escalating. This library replaces the instruction with states.

Per turn it keeps an affect state - valence, arousal, escalation_delta, stance, subtext - so a trend exists as data instead of being re-guessed from each message. An intent classifier keeps the whole posterior over six intents instead of one number, and a one-step Bayes-risk router decides from that distribution whether to act or ask. The two states pick one policy family (mirror, validate_redirect, direct, ask, deflate, repair, hold, boundary), which is then split into orthogonal controls - task_move, social_move, repair_move, realization - so a tone change can't silently drop the actual request. The factored action compiles into a system instruction and prompt prefix.

There is a structural audit after generation too: question budget, required clarification, unsupported privacy promises, repeated repair, low-verbosity overrun. It checks the contract, not facts.

Install:

pip install "eq-layer[ml]"
npm install -g eq-layer

One honest limit: the core claim is untested. No real-model A/B run has been rated, the pre-registered protocol in eval/AB_PROTOCOL.md is pending with zero adjudicated labels, and the steering stays at prompt level - the logit_bias field is a placeholder that is never populated or applied.

1 Upvotes

0 comments sorted by