Spaces:
Runtime error
Runtime error
Update AICoreAGIX_with_TB.py
Browse files- AICoreAGIX_with_TB.py +19 -11
AICoreAGIX_with_TB.py
CHANGED
@@ -9,20 +9,23 @@ from typing import List, Dict, Any
|
|
9 |
from cryptography.fernet import Fernet
|
10 |
from jwt import encode, decode, ExpiredSignatureError
|
11 |
from datetime import datetime, timedelta
|
12 |
-
#blockchain_module
|
13 |
import speech_recognition as sr
|
14 |
import pyttsx3
|
15 |
import os
|
16 |
|
17 |
-
|
18 |
from CodriaoCore.multi_model_analyzer import MultiAgentSystem
|
19 |
-
from
|
20 |
from CodriaoCore.federated_learning import FederatedAI
|
21 |
-
from utils.database import
|
22 |
from logger import logger
|
23 |
from secure_memory_loader import SecureMemorySession
|
24 |
from codriao_tb_module import CodriaoHealthModule
|
25 |
|
|
|
|
|
|
|
|
|
26 |
class AICoreAGIX:
|
27 |
def __init__(self, config_path: str = "config.json"):
|
28 |
self.ethical_filter = EthicalFilter()
|
@@ -35,7 +38,7 @@ class AICoreAGIX:
|
|
35 |
self.database = Database()
|
36 |
self.multi_agent_system = MultiAgentSystem()
|
37 |
self.self_reflective_ai = SelfReflectiveAI()
|
38 |
-
self.
|
39 |
self.federated_ai = FederatedAI()
|
40 |
|
41 |
# Security + Memory
|
@@ -69,20 +72,25 @@ class AICoreAGIX:
|
|
69 |
|
70 |
# Vectorize and encrypt
|
71 |
vectorized_query = self._vectorize_query(query)
|
72 |
-
self.
|
73 |
|
74 |
# (Optional) retrieve memory
|
75 |
-
user_vectors = self.
|
76 |
|
77 |
# Main AI processing
|
78 |
model_response = await self._generate_local_model_response(query)
|
79 |
agent_response = self.multi_agent_system.delegate_task(query)
|
80 |
self_reflection = self.self_reflective_ai.evaluate_response(query, model_response)
|
81 |
-
neural_reasoning = self.
|
82 |
-
|
83 |
-
final_response =
|
|
|
|
|
|
|
|
|
|
|
84 |
self.database.log_interaction(user_id, query, final_response)
|
85 |
-
#blockchain_module.store_interaction(user_id, query, final_response)
|
86 |
self._speak_response(final_response)
|
87 |
|
88 |
return {
|
|
|
9 |
from cryptography.fernet import Fernet
|
10 |
from jwt import encode, decode, ExpiredSignatureError
|
11 |
from datetime import datetime, timedelta
|
12 |
+
# blockchain_module
|
13 |
import speech_recognition as sr
|
14 |
import pyttsx3
|
15 |
import os
|
16 |
|
|
|
17 |
from CodriaoCore.multi_model_analyzer import MultiAgentSystem
|
18 |
+
from neuro_symbolic import NeuroSymbolicEngine # Updated import
|
19 |
from CodriaoCore.federated_learning import FederatedAI
|
20 |
+
from utils.database import Database # Ensure this module exports Database correctly
|
21 |
from logger import logger
|
22 |
from secure_memory_loader import SecureMemorySession
|
23 |
from codriao_tb_module import CodriaoHealthModule
|
24 |
|
25 |
+
# Ensure these modules exist or update the paths accordingly.
|
26 |
+
from ethical_filter import EthicalFilter
|
27 |
+
from self_reflective_ai import SelfReflectiveAI
|
28 |
+
|
29 |
class AICoreAGIX:
|
30 |
def __init__(self, config_path: str = "config.json"):
|
31 |
self.ethical_filter = EthicalFilter()
|
|
|
38 |
self.database = Database()
|
39 |
self.multi_agent_system = MultiAgentSystem()
|
40 |
self.self_reflective_ai = SelfReflectiveAI()
|
41 |
+
self.neural_symbolic_engine = NeuroSymbolicEngine() # Updated instantiation
|
42 |
self.federated_ai = FederatedAI()
|
43 |
|
44 |
# Security + Memory
|
|
|
72 |
|
73 |
# Vectorize and encrypt
|
74 |
vectorized_query = self._vectorize_query(query)
|
75 |
+
self.secure_memory_loader.encrypt_vector(user_id, vectorized_query)
|
76 |
|
77 |
# (Optional) retrieve memory
|
78 |
+
user_vectors = self.secure_memory_loader.decrypt_vectors(user_id)
|
79 |
|
80 |
# Main AI processing
|
81 |
model_response = await self._generate_local_model_response(query)
|
82 |
agent_response = self.multi_agent_system.delegate_task(query)
|
83 |
self_reflection = self.self_reflective_ai.evaluate_response(query, model_response)
|
84 |
+
neural_reasoning = self.neural_symbolic_engine.integrate_reasoning(query) # Updated usage
|
85 |
+
|
86 |
+
final_response = (
|
87 |
+
f"{model_response}\n\n"
|
88 |
+
f"{agent_response}\n\n"
|
89 |
+
f"{self_reflective_ai}\n\n"
|
90 |
+
f"Logic: {neural_reasoning}"
|
91 |
+
)
|
92 |
self.database.log_interaction(user_id, query, final_response)
|
93 |
+
# blockchain_module.store_interaction(user_id, query, final_response)
|
94 |
self._speak_response(final_response)
|
95 |
|
96 |
return {
|