senti-beta / scratch /debug_markets.py
joseph njoroge kariuki
Deploy Senti AI to Hugging Face Spaces
021e065
import os
import sys
import traceback
def run_debug():
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
senti_markets_dir = os.path.join(base_dir, "senti_markets")
if base_dir not in sys.path:
sys.path.insert(0, base_dir)
if senti_markets_dir not in sys.path:
sys.path.insert(0, senti_markets_dir)
os.chdir(senti_markets_dir)
from intelligence.brain import brain
scan_result = {
"asset": "EURUSD",
"timeframe": "H1",
"price": 1.0850,
"rsi": 28.5,
"atr": 0.0015,
"regime": "trending_down",
"signals": [
{"name": "RSI Oversold", "type": "technical"}
]
}
print("Running brain.analyze() with full exceptions enabled...")
# Temporarily monkeypatch reason_sync to print or trace
from senti.core.engines.superpacks.rlm_engine import reason_sync
# We will call it directly to see if it succeeds
print("Calling reason_sync directly...")
try:
from senti.core.engines.superpacks.rlm_engine import RLMEngine
# Let's inspect RLMEngine behavior
engine = RLMEngine(model="senti-markets-rlm", timeout=180.0)
import asyncio
res = asyncio.run(engine.reason(
query="Analyze EURUSD.",
context={"asset": "EURUSD"}
))
print("Direct reason_sync result:", res)
except Exception as e:
print("Direct call failed:")
traceback.print_exc()
if __name__ == "__main__":
run_debug()