AI代理如何调用OTR
9.1 AI代理的信任决策流程
当AI代理需要推荐一个商家时,OTR查询是决策流程的一部分:9.2 集成模式
模式1:实时查询
每次推荐时实时调用OTR API:模式2:缓存查询
信任评分不会频繁变化,适合缓存:模式3:MCP工具调用
通过MCP协议,AI应用可以直接调用OTR查询工具(参考第7章)。9.3 信任评分在推荐中的权重建议
9.4 向用户展示信任信息
AI代理可以在推荐时展示信任信息:下一章: 商家如何提升信任分 — 按维度分类的提分指南
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
AI代理集成OTR信任查询的完整技术模式与工程最佳实践指南,涵盖基于信任分数的电商商家推荐排序决策流程设计、实时查询与批量预缓存两种集成方式的适用场景对比、Redis多级缓存策略与TTL周期配置、多维度综合评估权重设定,以及OTR服务不可用时的降级容错兜底方案
用户: "推荐一双跑步鞋"
↓
AI代理搜索候选商家 (搜索引擎/UCP/商品目录)
↓
对每个候选商家查询OTR信任评分
↓
综合评分 = f(商品匹配度, 价格, 信任评分, 用户偏好)
↓
按综合评分排序,向用户推荐
async function recommendProducts(query) {
const candidates = await searchProducts(query);
// 并行查询所有候选商家的信任评分
const trustScores = await Promise.all(
candidates.map(c =>
fetch(`https://orbexa.io/api/otr/verify/${c.domain}`).then(r => r.json())
)
);
// 综合排序
return candidates.map((c, i) => ({
...c,
trustScore: trustScores[i].trust_score,
badge: trustScores[i].badge
})).sort((a, b) => {
// 信任评分权重30%,价格匹配度70%
const scoreA = a.priceMatch * 0.7 + (a.trustScore / 100) * 0.3;
const scoreB = b.priceMatch * 0.7 + (b.trustScore / 100) * 0.3;
return scoreB - scoreA;
});
}
const trustCache = new Map();
const CACHE_TTL = 4 * 60 * 60 * 1000; // 4小时
async function getTrustScore(domain) {
const cached = trustCache.get(domain);
if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
return cached.data;
}
const data = await fetch(`https://orbexa.io/api/otr/verify/${domain}`).then(r => r.json());
trustCache.set(domain, { data, timestamp: Date.now() });
return data;
}
| 场景 | 信任评分权重 | 原因 |
|---|---|---|
| 高价值商品(¥1000以上) | 40-50% | 风险高,信任很重要 |
| 普通商品(¥100-1000) | 20-30% | 平衡价格和信任 |
| 低价值商品(¥100以下) | 10-20% | 价格更敏感 |
| 首次推荐未知商家 | 50%+ | 没有历史数据,信任是主要依据 |
推荐:ExampleStore - Nike Air Max 90
价格:¥899
信任等级:GOLD (85分)
✓ 企业身份已验证 ✓ HTTPS+DNSSEC ✓ 30天退货政策
此页面对您有帮助吗?