Source Verification and Citation
Cross-referencing claims across sources and attaching source URLs to facts.
Why Source Verification Matters
An agent can retrieve a false claim from a low-quality source and present it as fact. Without verification, the research agent is just a sophisticated search engine with no quality filter.
Verification adds a layer that checks whether claims are corroborated by multiple independent sources.
The Two-Source Rule
A claim is considered verified when it appears in at least two independent sources. 'Independent' means different domains — finding the same claim on two sites that both cite the same original article does not count.
from urllib.parse import urlparse
def extract_domain(url: str) -> str:
return urlparse(url).netloc.replace('www.', '')
def is_verified(fact: str, all_facts: list[dict]) -> bool:
matching_domains = set()
for f in all_facts:
if fact.lower() in f['fact'].lower() or f['fact'].lower() in fact.lower():
matching_domains.add(extract_domain(f['source']))
return len(matching_domains) >= 2
# Example
facts = [
{'fact': 'Inflation peaked at 9.1% in June 2022', 'source': 'https://bls.gov/cpi'},
{'fact': 'US inflation hit 9.1% peak in mid-2022', 'source': 'https://reuters.com/article/a'}
]
print(is_verified('inflation peaked at 9.1%', facts)) # TrueAll lessons in this course
- Multi-Step Research Loop Design
- Source Verification and Citation
- Structured Report Generation
- Fact-Checking and Hallucination Prevention