Spaces:
Configuration error
Configuration error
π HF Space β Automated Requirement Citation Checker
This Space ingests a CSV with columns: Prompt, Rubric, ID, Requirements, Important Evaluation Rules and verifies each atomic claim in the Requirements column against the public web.
It searches via Google Custom Search (CSE), fetches top pages, and asks both OpenAI and DeepSeek LLMs to decide if each claim is SUPPORTED, CONTRADICTED, or UNVERIFIABLE, returning citations and a concise reason. A per-row conclusion is computed from all claims.
Quick Start (Hugging Face Spaces)
- Create a new Space β SDK: Gradio β Visibility: your choice.
- Upload these files to the Space root:
app.pyverifier.pysearch.pymodels.pyutils.pyrequirements.txt.env.template(optional for local dev)
- In the Space page β Settings β Secrets, add:
OPENAI_API_KEYβ your OpenAI key (you mentionedOAPI1).DEEPSEEK_API_KEYβ your DeepSeek key (you mentionedDAPI).GOOGLE_API_KEYβ Google API key (you mentionedAPI1).GOOGLE_CSE_IDβ your CSE ID (you mentionedCX1).- (Optional)
OPENAI_MODEL(defaultgpt-4o-mini) - (Optional)
DEEPSEEK_MODEL(defaultdeepseek-chat)
- Deploy. Open the Space, upload your CSV, and click Run Verification.
Output
- Table view summarizing Supported/Contradicted/Unverifiable counts and overall conclusion per row.
- JSON with full detail (per-claim statuses, reasons, citations, and both models' raw decisions).
- Markdown report with human-readable results and links.
CSV Format
Columns required (case-sensitive):
PromptRubricIDRequirementsImportant Evaluation Rules
Only Requirements is fact-checked; other columns are passed through for context if you want to extend prompts later.
How it works
utils.split_atomic_claimsheuristically splits Requirements text into atomic claims (lists + sentences).search.google_csequeries Google CSE (multiple queries per claim), collects unique result links.search.fetch_pagedownloads pages and extracts plain text + titles for LLM review.verifier.verify_claimbuilds a single packed prompt with all sources and asks both OpenAI & DeepSeek to return structured JSON:{ "status": "SUPPORTED|CONTRADICTED|UNVERIFIABLE", "reason": "brief rationale", "citations": [{"url": "...", "title": "...", "quote": "short"}] }- An ensemble chooses the final status; the other modelβs output is preserved for transparency.
verifier.verify_requirementaggregates claim-level results and computes a row-level conclusion:- Any CONTRADICTED β CONTRADICTED
- Else if all supported β SUPPORTED
- Else if mixed β PARTIALLY SUPPORTED
- Else β UNVERIFIABLE
Local Development
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.template .env # fill keys
python app.py
Notes & Tips
- Be conservative: the models are instructed to mark UNVERIFIABLE when evidence is insufficient.
- You can tune the number of search results and page length limits in
search.py. - For highly technical domains, consider whitelisting official domains in your CSE for higher precision.
- If you hit rate limits, Tenacity will retry with exponential backoff.
License
MIT