"""Full graph test — runs the actual compiled LangGraph (build_graph()), not individual node functions. First test of LangGraph's own conditional edges, the multi-claim loop, and build_report's aggregation. Claim/evidence choices, for later documentation: 1. "Attention... without relying on recurrence" / Vaswani et al. 2017 — reused from test_chain_live.py, already confirmed to produce a clean, correct SUPPORT. Chosen here to check the loop can process a claim end-to-end when NO escalation is needed. 2. A claim about training-data requirements, citing the same paper — the Vaswani abstract does not discuss data efficiency at all, so this is expected to land on NOT_ENOUGH_INFO. Chosen to exercise a second, different verdict type in the same run (not to force disagreement — escalate's retry/adjudicator logic was already confirmed separately in test_escalate_live.py). Requires GROQ_API_KEY and S2_API_KEY set in your environment. Run from the veriscite/ root: python -m tests.test_full_graph_live """ import asyncio import json from app.graph.build import build_graph SAMPLE_TEXT = """ Body: Attention mechanisms allow transformer models to capture long-range dependencies in sequential data without relying on recurrence [1]. Transformers require substantially more labeled training data than recurrent architectures to reach comparable accuracy [1]. References: [1] Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., & Polosukhin, I. (2017). Attention is all you need. In Advances in Neural Information Processing Systems (NeurIPS 2017). """ async def main(): graph = build_graph() initial_state = { "source_text": SAMPLE_TEXT, "claims": [], "audits": [], "current_index": 0, "report": None, } final_state = await graph.ainvoke(initial_state) report = final_state["report"] print("REPORT SUMMARY:") print(" n_claims:", report["n_claims"]) print(" initial_agreement_rate:", report["initial_agreement_rate"]) print(" n_escalated:", report["n_escalated"]) print(" n_resolved_by_retry:", report["n_resolved_by_retry"]) print(" n_resolved_by_adjudicator:", report["n_resolved_by_adjudicator"]) print() for i, audit in enumerate(report["claims"], 1): print(f"CLAIM {i}: {audit['claim_citation']['claim']}") print(f" final_verdict: {audit['final_verdict']}") print(f" escalated: {audit['escalated']}") print() if __name__ == "__main__": asyncio.run(main())