R2R[1](Reason to Retrieve)是一个先进的 AI 检索系统,支持检索增强生成(Retrieval-Augmented Generation,RAG)功能,并具备生产级特性。它基于 RESTful API 构建,提供多模态内容摄取、混合搜索、知识图谱以及全面的文档管理功能。
此外,R2R 还包含一个深度研究 API,能够从知识库和互联网中获取相关数据,为复杂查询提供更丰富、更具上下文感知能力的答案。
.txt、.pdf、.json、.png、.mp3等多种格式文件。R2R 可广泛应用于需要高效检索和知识管理的场景,例如:
通过 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]。
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"# 深度研究风格输出
)
| 欢迎光临 链载Ai (https://www.lianzai.com/) | Powered by Discuz! X3.5 |