|
|
from core.codex_informer import CodexInformer |
|
|
from core.eil_processor import EILProcessor |
|
|
from core.esil_inference import ESILInference |
|
|
from core.eris_reasoner import ERISReasoner |
|
|
from core.hei_inference import HEIInference |
|
|
from core.fec_controller import FECController |
|
|
import yaml |
|
|
|
|
|
def run_pipeline(user_input_text, force_hei=False): |
|
|
print("\n--- MEC MVP Test Run ---") |
|
|
print(f"[Main] Pipeline Input: {user_input_text}") |
|
|
|
|
|
|
|
|
with open('config/response_strategies.yaml', 'r', encoding='utf-8') as f: |
|
|
response_strategies = yaml.safe_load(f)['response_strategies'] |
|
|
|
|
|
|
|
|
codex_informer = CodexInformer() |
|
|
eil = EILProcessor(codex_informer) |
|
|
|
|
|
|
|
|
eil_packet = eil.infer_emotion(user_input_text) |
|
|
print(f"[Main] EIL Packet Output: {eil_packet}") |
|
|
|
|
|
|
|
|
esil = ESILInference(codex_informer) |
|
|
esil_packet = esil.infer_esil(eil_packet) |
|
|
|
|
|
|
|
|
if force_hei: |
|
|
print("\n[Main] FORCE HEI MODE ENABLED — Routing to HEI Inference") |
|
|
esil_packet['confidence_score'] = 0.40 |
|
|
|
|
|
print(f"[Main] ESIL Packet Output: {esil_packet}") |
|
|
|
|
|
|
|
|
if esil_packet['confidence_score'] >= 0.65: |
|
|
print("\n[Main] Routing: proceed_to_eris") |
|
|
|
|
|
eris = ERISReasoner() |
|
|
final_uesp = eris.reason_emotion_state(esil_packet) |
|
|
print(f"[Main] ERIS Packet Output: {final_uesp}") |
|
|
|
|
|
|
|
|
fec = FECController() |
|
|
fusion_prompt = fec.generate_prompt(final_uesp) |
|
|
print(f"[Main] Final Fusion Prompt:\n{fusion_prompt}") |
|
|
|
|
|
|
|
|
fam_code = final_uesp.get('primary_emotion_code') or final_uesp.get('Primary Emotion Code') |
|
|
rsm_code = response_strategies.get(fam_code, {}).get('rsm_code', 'RSM-UNKNOWN') |
|
|
strategy_name = response_strategies.get(fam_code, {}).get('strategy', 'Strategy not defined') |
|
|
sample_response = response_strategies.get(fam_code, {}).get('sample_response', 'No response available') |
|
|
|
|
|
simulated_output = ( |
|
|
f"Response Strategy Code: {rsm_code}\n" |
|
|
f"Response Strategy: {strategy_name}\n\n" |
|
|
f"{sample_response}" |
|
|
) |
|
|
|
|
|
print(f"\n[Main] Simulated Empathic Response:\n{simulated_output}") |
|
|
|
|
|
elif esil_packet['confidence_score'] < 0.65: |
|
|
print("\n[Main] Routing: escalate_to_hei") |
|
|
|
|
|
hei = HEIInference() |
|
|
pseudo_esil = hei.detect_low_signal(esil_packet) |
|
|
print(f"[Main] Pseudo-ESIL Output:\n{pseudo_esil}") |
|
|
|
|
|
|
|
|
print("\n[Main] Continuing to ERIS Reasoner (Post-HEI Path)") |
|
|
eris = ERISReasoner() |
|
|
final_uesp = eris.reason_emotion_state(pseudo_esil) |
|
|
print(f"[Main] ERIS Packet Output: {final_uesp}") |
|
|
|
|
|
fec = FECController() |
|
|
fusion_prompt = fec.generate_prompt(final_uesp) |
|
|
print(f"[Main] Final Fusion Prompt:\n{fusion_prompt}") |
|
|
|
|
|
|
|
|
fam_code = final_uesp.get('primary_emotion_code') or final_uesp.get('Primary Emotion Code') |
|
|
rsm_code = response_strategies.get(fam_code, {}).get('rsm_code', 'RSM-UNKNOWN') |
|
|
strategy_name = response_strategies.get(fam_code, {}).get('strategy', 'Strategy not defined') |
|
|
sample_response = response_strategies.get(fam_code, {}).get('sample_response', 'No response available') |
|
|
|
|
|
simulated_output = ( |
|
|
f"Response Strategy Code: {rsm_code}\n" |
|
|
f"Response Strategy: {strategy_name}\n\n" |
|
|
f"{sample_response}" |
|
|
) |
|
|
|
|
|
print(f"\n[Main] Simulated Empathic Response:\n{simulated_output}") |
|
|
|
|
|
else: |
|
|
print("\n[Main] Routing: LLM Assist — Not implemented") |
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
|
test_input = "I am feeling joy" |
|
|
|
|
|
|
|
|
run_pipeline(test_input, force_hei=False) |
|
|
|