微信扫码
添加专属顾问
我要投稿
大多数现有方法仅从检索语料库中检索短的连续块,限制了对整个文档上下文的整体理解。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-03-21
面向手机Agent的记忆系统工程:OPPO的Agentic-RAG实战与演进
2026-03-20
为什么总感觉 Claude Code 比 Cursor 聪明?真正的原因根本不是模型能力!
2026-03-18
从RAG到GraphRAG:货拉拉元数据检索应用实践
2026-03-17
企业AI落地三重门,用友如何破局?
2026-03-16
Java 开发者的轻量级 RAG 方案:MeiliSearch 混合搜索实战
2026-03-11
Embedding相似度虚高,如何用langchain+Milvus搭建CRAG解决?
2026-03-11
上下文腐烂:拖垮企业AI与LLM表现的隐患与对策
2026-03-10
从向量里逆向出原始文本和模型来源
2026-01-15
2026-01-02
2025-12-23
2026-02-13
2026-02-03
2025-12-31
2026-01-06
2026-02-03
2025-12-29
2026-02-06
2026-03-17
2026-03-11
2026-02-22
2026-02-15
2026-02-04
2026-02-03
2026-01-19
2026-01-12