Spaces:
Runtime error
Runtime error
Update AICoreAGIX_with_TB.py
Browse files- AICoreAGIX_with_TB.py +8 -1
AICoreAGIX_with_TB.py
CHANGED
@@ -25,6 +25,7 @@ from codriao_tb_module import CodriaoHealthModule
|
|
25 |
from fail_safe import AIFailsafeSystem
|
26 |
from quarantine_engine import QuarantineEngine
|
27 |
from anomaly_score import AnomalyScorer
|
|
|
28 |
|
29 |
class AICoreAGIX:
|
30 |
def __init__(self, config_path: str = "config.json"):
|
@@ -40,6 +41,8 @@ class AICoreAGIX:
|
|
40 |
self.neural_symbolic_engine = NeuroSymbolicEngine()
|
41 |
self.federated_ai = FederatedAI()
|
42 |
self.failsafe_system = AIFailsafeSystem()
|
|
|
|
|
43 |
def engage_lockdown_mode(self, reason="Unspecified anomaly"):
|
44 |
timestamp = datetime.utcnow().isoformat()
|
45 |
self.lockdown_engaged = True
|
@@ -120,8 +123,12 @@ def _load_config(self, config_path: str) -> dict:
|
|
120 |
"""Vectorizes user query using tokenizer."""
|
121 |
tokenized = self.tokenizer(query, return_tensors="pt")
|
122 |
return tokenized["input_ids"].detach().numpy()
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
125 |
try:
|
126 |
# Validate query input
|
127 |
if not isinstance(query, str) or len(query.strip()) == 0:
|
|
|
25 |
from fail_safe import AIFailsafeSystem
|
26 |
from quarantine_engine import QuarantineEngine
|
27 |
from anomaly_score import AnomalyScorer
|
28 |
+
from ethics_core import EthicsCore
|
29 |
|
30 |
class AICoreAGIX:
|
31 |
def __init__(self, config_path: str = "config.json"):
|
|
|
41 |
self.neural_symbolic_engine = NeuroSymbolicEngine()
|
42 |
self.federated_ai = FederatedAI()
|
43 |
self.failsafe_system = AIFailsafeSystem()
|
44 |
+
self.ethics_core = EthicsCore()
|
45 |
+
|
46 |
def engage_lockdown_mode(self, reason="Unspecified anomaly"):
|
47 |
timestamp = datetime.utcnow().isoformat()
|
48 |
self.lockdown_engaged = True
|
|
|
123 |
"""Vectorizes user query using tokenizer."""
|
124 |
tokenized = self.tokenizer(query, return_tensors="pt")
|
125 |
return tokenized["input_ids"].detach().numpy()
|
126 |
+
if not self.ethics_core.evaluate_action(final_response):
|
127 |
+
logger.warning("[Codriao Ethics] Action blocked: Does not align with internal ethics.")
|
128 |
+
return {"error": "Response rejected by ethical framework"}
|
129 |
+
|
130 |
|
131 |
+
async def generate_response(self, query: str, user_id: int) -> Dict[str, Any]:
|
132 |
try:
|
133 |
# Validate query input
|
134 |
if not isinstance(query, str) or len(query.strip()) == 0:
|