Evidence Pack for Trustworthy Paper Citations
RAGToolsIntermediate
Evidence Pack for Trustworthy Paper Citations
Standardize claim, quote, doc_id, chunk_id, offset, page_no, and title as a base template for RAG and agents
Scenario
Every RAG or agent workflow needs a standardized citation package. This example defines an Evidence Pack structure and shows how to build it from Sciverse results.
Estimated calls
~8-15 API calls per build
Tools
agentic-searchcontentPipeline
claim 列表→ agentic-search 逐条检索→ content 定位原文→ 标准化 evidence pack
Input example
Input claim: "Transformer-based models improved protein structure prediction accuracy." Need: retrieve evidence and output a standardized citation object.
Output example
{
"claim": "...",
"quote": "...",
"doc_id": "...",
"offset": 12480,
"title": "...",
"confidence": "supported"
}Agent Prompt example
You are an evidence packaging assistant. For each claim, retrieve supporting sources, verify quotes, and output a normalized Evidence Pack object.Implementation steps
Step 1: Set up the environment
Configure token and dependencies
!pip install httpx
import os
os.environ["SCIVERSE_API_TOKEN"] = "sv-your-token-here" # 替换为你的真实值
Step 2: Define the Evidence Pack schema
Create a reusable schema for claim-level evidence
from dataclasses import dataclass, asdict
from typing import Optional
import json
@dataclass
class EvidenceItem:
claim: str
quote: str
doc_id: str
offset: int
title: str
venue: Optional[str] = None
year: Optional[int] = None
confidence: float = 0.0
@dataclass
class EvidencePack:
items: list[EvidenceItem]
def to_json(self) -> str:
return json.dumps({"evidence_pack": [asdict(i) for i in self.items]}, ensure_ascii=False, indent=2)
# \u793a\u4f8b
pack = EvidencePack(items=[])
print(pack.to_json())
Step 3: Retrieve and build citations for each claim
Search, verify, and populate the schema for each claim
import os
import asyncio
import httpx
BASE = "https://api.sciverse.space"
TOKEN = os.environ["SCIVERSE_API_TOKEN"]
HEADERS = {"Authorization": f"Bearer {TOKEN}"}
async def build_evidence(claim: str) -> Optional[EvidenceItem]:
"""\u4e3a\u5355\u4e2a claim \u68c0\u7d22\u5e76\u6784\u5efa\u5f15\u7528"""
async with httpx.AsyncClient(timeout=30) as client:
# Step 1: \u8bed\u4e49\u68c0\u7d22
resp = await client.post(
f"{BASE}/agentic-search", headers=HEADERS,
json={"query": claim, "top_k": 5}
)
resp.raise_for_status()
hits = (resp.json().get("hits") or [])
if not hits:
return None
best = hits[0]
# Step 2: \u8bfb\u53d6\u539f\u6587\u5b9a\u4f4d\u786e\u5207\u5f15\u7528
resp2 = await client.get(
f"{BASE}/content", headers=HEADERS,
params={"doc_id": best["doc_id"], "offset": best.get("offset", 0), "limit": 800}
)
resp2.raise_for_status()
text = resp2.json()["text"]
return EvidenceItem(
claim=claim,
quote=text[:200], # \u53d6\u524d 200 \u5b57\u7b26\u4f5c\u4e3a\u5f15\u7528
doc_id=best["doc_id"],
offset=best.get("offset", 0),
title=best["title"],
confidence=best["score"]
)
claims = [
"AlphaFold2 \u5728 CASP14 \u4e2d\u8fbe\u5230\u4e86\u5b9e\u9a8c\u7cbe\u5ea6",
"mRNA \u7684 LNP \u9012\u9001\u7cfb\u7edf\u663e\u8457\u63d0\u9ad8\u4e86\u7ec6\u80de\u5185\u5316\u6548\u7387",
]
async def main():
items = []
for claim in claims:
evidence = await build_evidence(claim)
if evidence:
items.append(evidence)
print(f"\u2713 {claim[:40]}... -> {evidence.doc_id}")
else:
print(f"\u2717 {claim[:40]}... -> no evidence found")
pack = EvidencePack(items=items)
print(f"\
Evidence Pack ({len(items)}/{len(claims)} claims grounded):")
print(pack.to_json())
await main()
Notes
- Evidence Pack is a data contract between retrieval and generation.
- Keep raw source metadata, not just formatted citations.
- Use exact quotes only when they appear in source text.
- Add confidence or support labels for downstream reasoning.
- Validate the schema before passing it to an LLM.
FAQ
Evidence Pack 是什么?
是将 claim、quote、doc_id、offset、title 等字段标准化后的引用证据包。
为什么需要 Evidence Pack?
它让 Agent 输出的科学结论可以被追溯、复核和复用。
Evidence Pack 应包含哪些字段?
至少包含 claim、quote、doc_id、offset、title、year 和 confidence。
quote 可以由模型改写吗?
不建议,quote 应来自原文,模型可以另写解释但不能替代原文证据。
Next steps
Need an API key?
Create one in Console > Tokens.The same API key works for enabled Sciverse, DianShi, and Skills capabilities, with starter quota available according to account permissions.