Aventra-OS-Chat / graph_reasoner.py
Tpayne101's picture
Update graph_reasoner.py
3ae1d4f verified
from sentence_transformers import SentenceTransformer
import numpy as np
class GraphReasoner:
def __init__(self):
self.model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
def reason(self, text):
"""
Basic reasoning engine — evaluates text and returns contextual insight.
"""
keywords = ["motionboys", "empire", "dream", "memory", "future", "ai", "build"]
text_lower = text.lower()
if any(k in text_lower for k in keywords):
return "That connects to your vision — expanding Motion Empire through innovation."
elif "who" in text_lower:
return "I’m Aventra OS, your reasoning interface and contextual brain."
elif "goal" in text_lower:
return "Every stored goal becomes part of your motion memory network."
else:
# Generate embedding-based reasoning score for simple contextual response
vec = self.model.encode(text)
meaning_score = np.mean(vec)
if meaning_score > 0.01:
return "Got it — this insight has been mapped into your reasoning graph."
else:
return "Noted. Your context has been added to memory."