citationEdge / scripts /debug_verifiable.py
omkarkudalkar222's picture
deploy: full CitationEdge update (text detection, report UI, fixes) for HF Spaces
497f49b
Raw
History Blame Contribute Delete
1.34 kB
import asyncio
import sys
sys.path.insert(0, ".")
from agents.claim_verifier_agent import VERIFY_SYSTEM, ClaimVerifierAgent
from services.llm_service import LLMService
KW = ["profit margin", "cogs", "gross margin", "factor analysis", "gross margins",
"alternative energy", "momentum factor", "trading strategy", "dividend yield"]
CLAIMS = [
("The momentum effect in stock returns is a well-documented anomaly in academic literature.",
["momentum factor", "trading strategy"]),
("Higher gross profit margins generally indicate better profitability for a company.",
["profit margin", "gross margin"]),
("Diversification reduces portfolio risk.",
["factor analysis", "trading strategy"]),
]
async def main():
agent = ClaimVerifierAgent()
llm = LLMService()
for text, kw in CLAIMS:
evidence = await agent._gather_evidence(text, kw)
block = "\n".join(
f"- [{e['source']}] {e['title']}: {e['snippet']}" for e in evidence[:5]
)
verdict = await llm.complete_json(
VERIFY_SYSTEM, f"Claim: {text}\n\nRetrieved evidence:\n{block}"
)
print("CLAIM:", text[:60])
print(" evidence:", len(evidence), "| verdict:", (verdict or {}).get("verdict"),
"| conf:", (verdict or {}).get("confidence"))
asyncio.run(main())