问题所在
LLM会自信地产生幻觉,没有外部验证时错误答案会直接传达给用户。内部评估无法捕获实时事实错误如价格变动或过期政策。
Scavio 解决方案
LLM生成答案后,提取关键声明,通过实时Scavio搜索逐一验证。当搜索结果与LLM声明矛盾时,用搜索结果中的正确数据替换。
之前
在添加搜索验证之前,面向客户的机器人告诉用户某软件的价格已经过时,导致客户投诉。
之后
添加搜索验证后,机器人的价格声明会与实时搜索结果核对。不匹配时自动用正确信息替换。
适用人群
发布面向客户的LLM产品并需要自动化事实核查层的AI团队。
核心优势
- 无需人工审核的实时幻觉检测
- 在错误到达用户前捕获价格、日期和事实错误
- 每次声明验证只需一次API调用,$0.005
- 作为后生成过滤器适用于任何LLM管道
- 搜索结果为正确答案提供引用来源
Python 示例
Python
import requests, os, json
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}
def verify_claim(claim: str, entity: str) -> dict:
"""Verify an LLM-generated claim against live search results."""
r = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'platform': 'google', 'query': f'{entity} {claim[:80]}'}, timeout=10).json()
snippets = [o.get('snippet', '') for o in r.get('organic', [])[:3]]
claim_lower = claim.lower()
support_signals = sum(1 for s in snippets if any(
term in s.lower() for term in claim_lower.split() if len(term) > 4))
return {
'claim': claim,
'supported': support_signals >= 2,
'evidence': snippets,
'action': 'pass' if support_signals >= 2 else 'flag_for_review'
}
result = verify_claim('Scavio costs $30 per month', 'Scavio search API pricing')
print(json.dumps(result, indent=2))JavaScript 示例
JavaScript
const H = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
async function verifyClaim(claim, entity) {
const r = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST', headers: H,
body: JSON.stringify({ platform: 'google', query: `${entity} ${claim.slice(0, 80)}` })
}).then(r => r.json());
const snippets = (r.organic || []).slice(0, 3).map(o => o.snippet || '');
const terms = claim.toLowerCase().split(' ').filter(t => t.length > 4);
const support = snippets.filter(s =>
terms.some(t => s.toLowerCase().includes(t))).length;
return { claim, supported: support >= 2, evidence: snippets,
action: support >= 2 ? 'pass' : 'flag_for_review' };
}使用的平台
包含知识图谱、PAA和AI概览的网页搜索
Amazon
包含价格、评分和评论的产品搜索