ThreatLevelD
commited on
Commit
·
cfe9aed
1
Parent(s):
3dfb7ca
Added ESILInference and ConfidenceGate core modules
Browse files- core/confidence_gate.py +25 -0
- core/esil_inference.py +25 -0
- main.py +21 -3
core/confidence_gate.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# core/confidence_gate.py
|
| 2 |
+
# Master Emotional Core (MEC) - Confidence Gate
|
| 3 |
+
|
| 4 |
+
class ConfidenceGate:
|
| 5 |
+
def __init__(self, confidence_threshold=0.65):
|
| 6 |
+
self.confidence_threshold = confidence_threshold
|
| 7 |
+
|
| 8 |
+
def evaluate_confidence(self, esil_packet):
|
| 9 |
+
confidence_score = esil_packet.get("confidence_score", 0.0)
|
| 10 |
+
|
| 11 |
+
if confidence_score >= self.confidence_threshold:
|
| 12 |
+
routing_decision = "proceed_to_eris"
|
| 13 |
+
elif confidence_score >= 0.5:
|
| 14 |
+
routing_decision = "trigger_llm_assist"
|
| 15 |
+
else:
|
| 16 |
+
routing_decision = "escalate_to_hei"
|
| 17 |
+
|
| 18 |
+
routing_packet = {
|
| 19 |
+
"confidence_score": confidence_score,
|
| 20 |
+
"routing_decision": routing_decision,
|
| 21 |
+
"source_metadata": esil_packet.get("source_metadata", {})
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
print(f"[ConfidenceGate] Packet: {routing_packet}")
|
| 25 |
+
return routing_packet
|
core/esil_inference.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# core/esil_inference.py
|
| 2 |
+
# Master Emotional Core (MEC) - ESIL Inference
|
| 3 |
+
|
| 4 |
+
class ESILInference:
|
| 5 |
+
def __init__(self, enable_gradient_blending=True, blend_maximum=3):
|
| 6 |
+
self.enable_gradient_blending = enable_gradient_blending
|
| 7 |
+
self.blend_maximum = blend_maximum
|
| 8 |
+
|
| 9 |
+
def infer_esil(self, eil_packet):
|
| 10 |
+
phrases = eil_packet.get("phrases", [])
|
| 11 |
+
emotion_candidates = eil_packet.get("emotion_candidates", [])
|
| 12 |
+
|
| 13 |
+
# Placeholder logic for MVP:
|
| 14 |
+
# Just return a single blend with a basic confidence
|
| 15 |
+
esil_packet = {
|
| 16 |
+
"blend_weights": [
|
| 17 |
+
{"emotion": "Pending", "weight": 0.8}
|
| 18 |
+
],
|
| 19 |
+
"trajectory": "Stable",
|
| 20 |
+
"confidence_score": 0.85,
|
| 21 |
+
"source_metadata": eil_packet.get("metadata", {})
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
print(f"[ESILInference] Packet: {esil_packet}")
|
| 25 |
+
return esil_packet
|
main.py
CHANGED
|
@@ -7,9 +7,9 @@ print("System ready — modules loading...")
|
|
| 7 |
# 1️⃣ Import modules
|
| 8 |
from core.input_preprocessor import InputPreprocessor
|
| 9 |
from core.eil_processor import EILProcessor
|
|
|
|
|
|
|
| 10 |
# Future imports:
|
| 11 |
-
# from core.esil_inference import ESILInference
|
| 12 |
-
# from core.confidence_gate import ConfidenceGate
|
| 13 |
# from core.hei_inference import HEIInference
|
| 14 |
# from core.eris_reasoner import ERISReasoner
|
| 15 |
# from core.uesp_constructor import UESPConstructor
|
|
@@ -34,4 +34,22 @@ eil_packet = eil_processor.process_eil(preprocessing_packet)
|
|
| 34 |
# Run EIL processing
|
| 35 |
|
| 36 |
# Print EIL packet
|
| 37 |
-
print(f"\n[Main] EIL Packet Output: {eil_packet}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# 1️⃣ Import modules
|
| 8 |
from core.input_preprocessor import InputPreprocessor
|
| 9 |
from core.eil_processor import EILProcessor
|
| 10 |
+
from core.esil_inference import ESILInference
|
| 11 |
+
from core.confidence_gate import ConfidenceGate
|
| 12 |
# Future imports:
|
|
|
|
|
|
|
| 13 |
# from core.hei_inference import HEIInference
|
| 14 |
# from core.eris_reasoner import ERISReasoner
|
| 15 |
# from core.uesp_constructor import UESPConstructor
|
|
|
|
| 34 |
# Run EIL processing
|
| 35 |
|
| 36 |
# Print EIL packet
|
| 37 |
+
print(f"\n[Main] EIL Packet Output: {eil_packet}")
|
| 38 |
+
|
| 39 |
+
# Initialize ESIL Inference
|
| 40 |
+
esil_inference = ESILInference()
|
| 41 |
+
|
| 42 |
+
# Run ESIL Inference
|
| 43 |
+
esil_packet = esil_inference.infer_esil(eil_packet)
|
| 44 |
+
|
| 45 |
+
# Print ESIL packet
|
| 46 |
+
print(f"\n[Main] ESIL Packet Output: {esil_packet}")
|
| 47 |
+
|
| 48 |
+
# Initialize Confidence Gate
|
| 49 |
+
confidence_gate = ConfidenceGate()
|
| 50 |
+
|
| 51 |
+
# Run Confidence Gate
|
| 52 |
+
routing_packet = confidence_gate.evaluate_confidence(esil_packet)
|
| 53 |
+
|
| 54 |
+
# Print Confidence Gate packet
|
| 55 |
+
print(f"\n[Main] Confidence Gate Output: {routing_packet}")
|