| """Chained test β extract_claims -> fetch_citation -> verify_dual, run for real. |
| |
| Uses a specific, checkable factual claim (not a motivation-style sentence, |
| unlike the earlier test) attributed to a real, findable paper. |
| |
| Requires GROQ_API_KEY and S2_API_KEY set in your environment. |
| |
| Run from the veriscite/ root: |
| python -m tests.test_chain_live |
| """ |
|
|
| import asyncio |
| from app.graph.nodes import extract_claims, fetch_citation, verify_dual |
|
|
| SAMPLE_TEXT = """ |
| Body: |
| Attention mechanisms allow transformer models to capture long-range |
| dependencies in sequential data without relying on recurrence [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(): |
| state = { |
| "source_text": SAMPLE_TEXT, |
| "claims": [], |
| "audits": [], |
| "current_index": 0, |
| "report": None, |
| } |
|
|
| state = await extract_claims(state) |
| print("STEP 1 β extract_claims:") |
| for c in state["claims"]: |
| print(" ", c) |
| print() |
|
|
| if not state["claims"]: |
| print("No claims extracted β stopping.") |
| return |
|
|
| state = await fetch_citation(state) |
| print("STEP 2 β fetch_citation:") |
| cc = state["claims"][0] |
| print(" resolved_paper_id:", cc["resolved_paper_id"]) |
| print(" evidence_text (first 250 chars):", (cc["evidence_text"] or "")[:250]) |
| print() |
|
|
| if not cc["evidence_text"]: |
| print("No evidence resolved β stopping.") |
| return |
|
|
| state = await verify_dual(state) |
| print("STEP 3 β verify_dual:") |
| audit = state["audits"][0] |
| print(" winner_sentence:", audit["winner_sentence"]) |
| print(" deberta_verdict:", audit["deberta_verdict"]) |
| print(" llm_verdict:", audit["llm_verdict"]) |
| print(" agreement:", audit["agreement"]) |
|
|
|
|
| if __name__ == "__main__": |
| asyncio.run(main()) |
|
|