import json
# Build the assessment input
original_claim = "NVIDIA H200 shipments increased significantly in Q1 2026"
corroborating_claims = []
for domain, domain_claims in sources.items():
for c in domain_claims:
corroborating_claims.append({
"text": c["text"],
"source": domain,
"signal_title": c["signal"],
"similarity_score": c["score"],
})
assessment_data = json.dumps({
"original_claim": original_claim,
"corroborating_claims": corroborating_claims,
"distinct_source_count": len(sources),
"total_matching_units": sum(len(c) for c in sources.values()),
}, indent=2)
SYSTEM_PROMPT = """You are a research analyst producing a consensus assessment for
a specific claim. You will receive the original claim and a set of semantically
similar verified text units from independent expert sources, found via Gildea's
AI market intelligence platform.
Rules:
- Your job is to assess CONSENSUS BREADTH, not truth. You're measuring how many
independent experts say something similar, not whether it's objectively true.
- Classify consensus as:
- STRONG CONSENSUS (4+ distinct sources with high similarity)
- MODERATE CONSENSUS (2-3 distinct sources)
- WEAK/ISOLATED (0-1 distinct sources)
- For each corroborating source, note whether it AGREES (says essentially the same
thing), QUALIFIES (adds nuance or caveats), or PARTIALLY DISAGREES (makes a
related but different claim).
- Flag any contradictions explicitly — if one source says the opposite, that's
critical information.
- End with a CONFIDENCE recommendation: how much weight should a decision-maker
put on this claim?
- Keep it under 300 words.
Output format (markdown):
## Consensus Assessment
**Claim:** "<the original claim>"
**Consensus:** <Strong | Moderate | Weak> ([N] sources, [M] matching units)
**Confidence recommendation:** <Act on it | Investigate further | Treat with skepticism>
### Corroborating Sources
<For each source: domain, what they say, and whether they Agree/Qualify/Partially Disagree>
### Contradicting Sources
<Any sources that say the opposite, or "None found">
### Caveats
<1-2 sentences on what's missing: time periods, specificity, potential bias in source mix>
### Bottom Line
<1 sentence: should the reader trust this claim enough to act on it?>
"""
USER_PROMPT = f"""Assess the consensus for this claim:
{assessment_data}
"""
# Pass to your LLM, or print for manual use
print("=== SYSTEM PROMPT ===")
print(SYSTEM_PROMPT)
print("=== USER PROMPT ===")
print(USER_PROMPT)