LastSearch
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
-blue.svg)
**Research infrastructure for AI agents with Grounded Intelligence** — real-time web search, evidence extraction, verification, and structured citations. Every claim is backed by a URL. Every answer has a confidence score.
Website · Playground · API Docs · Alternatives · Discord
> **Package names:** npm: lastsearch · PyPI: lastsearch · LangChain: langchain-lastsearch — Previously lastsearch and lastsearch. Old names still work and redirect automatically.
---
How It Works
Every answer goes through a multi-step verification pipeline. No hallucination. Every claim is backed by a real source.
Verification & Confidence Scoring
Confidence scores are **evidence-based** — not LLM self-assessed. After the LLM extracts claims and sources, a post-extraction verification engine checks every claim against the actual source page text:
1. **Atomic claim decomposition** — Compound claims are auto-split into individual verifiable facts. "Tesla had $96B revenue and 1.8M deliveries" becomes two atomic claims, each verified independently.
2. **Hybrid retrieval combining keyword and semantic matching** — For each claim, keyword matching finds lexical matches and dense embeddings find semantic matches from source text. Rankings are fused to catch paraphrased evidence that keyword matching alone misses (e.g., "prevents fabricated answers" matching "reduces hallucinations"). Premium tier only, with graceful keyword-only fallback.
3. **Semantic evidence reranking** — Top candidates per claim are reranked by a **purpose-built verification model trained on 1.4M+ claim-evidence pairs** that improves with every query. Selects the best supporting evidence, applies contradiction penalties and paraphrase boosts.
4. **Multi-provider search** — Parallel search across multiple providers for broader source diversity. More independent sources = stronger cross-reference = higher confidence.
5. **Domain authority scoring** — 10,000+ domains across 5 tiers (institutional .gov/.edu → major news → tech journalism → community → low-quality). Dynamic scoring that improves from real verification data.
6. **Source quote verification** — LLM-extracted quotes verified against actual page text using multi-strategy matching.
7. **Cross-source consensus** — Each claim verified against *all* available page texts. Claims supported by 3+ independent domains get "strong consensus". Single-source claims flagged as "weak".
8. **Contradiction detection** — Claim pairs analyzed for semantic conflicts using topic overlap and contradiction classification. Detected contradictions surfaced in the response and penalize confidence.
9. **Multi-pass consistency** — In thorough mode, claims are cross-checked across independent extraction passes. Claims confirmed by both passes get boosted; inconsistent claims are penalized.
10. **Auto-calibrated confidence** — Multi-factor confidence formula auto-adjusts from real user feedback. Predicted confidence aligns with actual accuracy over time. Factors: verification rate, domain authority, source count, consensus, domain diversity, claim grounding, source recency, and citation depth.
11. **Per-claim evidence retrieval** — Weak claims get targeted search queries generated by LLM, then searched individually across all providers. Each claim gets its own evidence pool instead of sharing the same corpus.
12. **Counter-query verification** — Verified claims are stress-tested with adversarial "what would disprove this?" search queries. If counter-evidence is found, claim confidence is penalized.
13. **Iterative confidence-gated retrieval** — Thorough mode uses a confidence-gated loop: verify → if weak claims remain → generate targeted query → search → re-verify. Loops up to 3 iterations with early termination when queries repeat or confidence meets threshold.
14. **Live citation health** — On thorough and deep, every cited URL is probed server-side and classified live (resolves now), stale (link rot — archived once), or dead (no DNS, no archive — likely fabricated). Deep-research agents hallucinate a meaningful share of citation URLs; this makes "every citation resolves" a checkable guarantee.
15. **Content integrity** — Every fetched page is scanned on the raw DOM *before* text extraction. Hidden / non-rendered content (HTML comments, display:none, off-screen, zero-font, hidden/aria-hidden, instruction-shaped meta/alt text, zero-width characters) — where ~70% of in-the-wild prompt injections live — is stripped so the extraction model never sees it, and instruction-shaped text is counted. Each source gets integrity (risk: none|low|high), each result a contentRisk summary. Instruction-directed spans are then surgically redacted from the text handed to the extraction model (sanitizedSpans) — research shows removal beats blocking — while the rest of the page is kept. Pass strict: true to exclude high-risk sources entirely. Deterministic rules, no guard model; on the open eval set (36 benign pages: 12 synthetic hard-benign + 24 real) it produced 0 high-risk false positives — a count on a small set, not a guarantee (95% upper bound ≈ 8% at n=36); raw results in eval/. **A signal for your agent's policy layer, not a guarantee** — adaptive attacks can bypass any content filter.