R2R 简介R2R[1](Reason to Retrieve)是一个先进的 AI 检索系统,支持检索增强生成(Retrieval-Augmented Generation,RAG)功能,并具备生产级特性。它基于 RESTful API 构建,提供多模态内容摄取、混合搜索、知识图谱以及全面的文档管理功能。 此外,R2R 还包含一个深度研究 API,能够从知识库和互联网中获取相关数据,为复杂查询提供更丰富、更具上下文感知能力的答案。 项目特点主要特点- 多模态摄取:支持解析
.txt、.pdf、.json、.png、.mp3等多种格式文件。 - 混合搜索:结合语义搜索和关键词搜索,通过互惠排名融合技术提升检索效果。
使用场景R2R 可广泛应用于需要高效检索和知识管理的场景,例如: - 企业知识库管理:快速检索和整合企业内部文档、资料等。
- 智能客服:为客服系统提供更准确的知识检索和回答生成。
- 市场分析:通过深度研究 API,分析市场趋势和社会影响。
项目使用云服务选项通过 SciPhi Cloud 使用 R2R,无需信用卡即可享受免费套餐,详细可参考快速开始[2]。  自托管选项pip install r2r exportOPENAI_API_KEY=sk-... python -m r2r.serve
gitclonegit@github.com:SciPhi-AI/R2R.git &&cdR2R exportR2R_CONFIG_NAME=full OPENAI_API_KEY=sk-... docker compose -f compose.full.yaml --profile postgres up -d
详细自托管指南请参考自托管文档[3]。 使用 API
pip install r2r exportR2R_API_KEY=pk_..sk_... # Get from SciPhi Cloud dashboard
npm i r2r-js exportR2R_API_KEY=pk_..sk_... # Get from SciPhi Cloud dashboard
fromr2rimportR2RClient client = R2RClient() # 如为自托管,请指定 base_url
const{ r2rClient } =require('r2r-js'); constclient =newr2rClient(); // 如为自托管,请指定 baseURL
client.documents.create_sample(hi_res=True)
client.documents.list()
results = client.retrieval.search(query="What is DeepSeek R1?")
response = client.retrieval.rag(query="What is DeepSeek R1?")
response = client.retrieval.agent( message={"role":"user","content":"What does deepseek r1 imply? Think about market, societal implications, and more."}, rag_generation_config={ "model"="anthropic/claude-3-7-sonnet-20250219", "extended_thinking":True, "thinking_budget":4096, "temperature":1, "top_p":None, "max_tokens_to_sample":16000, }, mode="research"# 深度研究风格输出 )
参考文档 
|