微信扫码
添加专属顾问
我要投稿
大多数现有方法仅从检索语料库中检索短的连续块,限制了对整个文档上下文的整体理解。RAPTOR(Recursive Abstractive Processing for Tree-Organized Retrieval)引入了一种新方法,即递归嵌入、聚类和总结文本块,从下往上构建具有不同总结级别的树。在推理时,RAPTOR 模型从这棵树中检索,整合不同抽象级别的长文档中的信息。RAPTOR(Recursive Abstractive Processing for Tree-Organized Retrieval)比传统的检索增强型 LM 性能与绝对准确度上提高 20%。
# 安装,在使用 RAPTOR 之前,请确保已安装 Python 3.8+。克隆 RAPTOR 存储库并安装必要的依赖项:git clone https://github.com/parthsarthi03/raptor.gitcd raptorpip install -r requirements.txt# 开始使用 RAPTOR,请按照以下步骤操作:# 首先,设置您的 OpenAI API 密钥并初始化 RAPTOR 配置:import osos.environ["OPENAI_API_KEY"] = "your-openai-api-key"from raptor import RetrievalAugmentation# Initialize with default configuration. For advanced configurations, check the documentation. [WIP]RA = RetrievalAugmentation()# 将您的文本文档添加到 RAPTOR 进行索引:with open('sample.txt', 'r') as file:text = file.read()RA.add_documents(text)# 现在可以使用 RAPTOR 根据索引文档回答问题:question = "How did Cinderella reach her happy ending?"answer = RA.answer_question(question=question)print("Answer: ", answer)# 将构造好的树保存到指定路径:SAVE_PATH = "demo/cinderella"RA.save(SAVE_PATH)# 将保存的树重新加载到 RAPTOR 中:RA = RetrievalAugmentation(tree=SAVE_PATH)answer = RA.answer_question(question=question)
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费POC验证,效果达标后再合作。零风险落地应用大模型,已交付160+中大型企业
2026-02-04
Claude Cowork 真能替换 RAG ?
2026-02-03
使用 Agent Skills 做知识库检索,能比传统 RAG 效果更好吗?
2026-02-03
告别向量数据库!PageIndex:让AI像人类专家一样阅读长文档
2026-02-02
OpenViking:面向 Agent 的上下文数据库
2026-02-02
别再迷信向量数据库了,RAG 的“大力出奇迹”该结束了
2026-01-29
告别黑盒开发!清华系团队开源 UltraRAG:用“搭积木”的方式构建复杂 RAG 流程
2026-01-28
RAG优化不抓瞎!Milvus检索可视化,帮你快速定位嵌入、切块、索引哪有问题
2026-01-28
今天,分享Clawdbot记忆系统最佳工程实践
2025-12-04
2025-12-03
2025-11-13
2025-12-02
2025-11-13
2026-01-15
2025-12-07
2026-01-02
2025-12-23
2025-12-18
2026-02-04
2026-02-03
2026-01-19
2026-01-12
2026-01-08
2026-01-02
2025-12-23
2025-12-21