"""Safety-net check: force the LLM router to 'decline' and confirm basic ticker questions still hit the tools. Usage: python eval/test_fallback.py""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import app # noqa: E402 app.llm_route = lambda message, history=None: [{"tool": "decline"}] CASES = ["Average return for NVDA 2020 to 2025", "NVDA 2020 to 2025", "how much did nvidia grow per year since 2020", "AAPL return 2015-2020", "What was Microsoft's annual return from 2012 through 2022?", "GOOGL annualized return 2010 to 2020", "Compare Apple and Nvidia from 2018 to 2023", "what's the yearly return on netflix since 2015", "What's NVDA trading at right now?", "current price of apple stock"] ok = 0 for q in CASES: calls = app.plan(q)[0] res = app.run_calls(calls) out = "\n".join(res["blocks"]) good = ("% per year" in out or "$" in out) and "unavailable" not in out ok += good print("PASS" if good else "FAIL", "|", q, "|", calls, "|", out.split("\n")[2] if out.count("\n") >= 2 else out) print(f"{ok}/{len(CASES)} passed with the router forced to decline")