修改rag,实现混合检索
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 5m42s

This commit is contained in:
2026-05-04 04:28:32 +08:00
parent d0590240f9
commit 82dde7113e
15 changed files with 536 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
# app/rag_initializer.py
from app.rag.tools import create_rag_tool_sync
from app.rag.tools import create_rag_tool_sync, create_rag_tool_async
from rag_core import create_parent_retriever
from app.model_services import get_embedding_service
from app.logger import info, warning
@@ -16,11 +16,11 @@ async def init_rag_tool(local_llm_creator):
embeddings=embeddings
)
rewrite_llm = local_llm_creator()
rag_tool = create_rag_tool_sync(
rag_tool = create_rag_tool_async(
retriever, rewrite_llm,
num_queries=3, rerank_top_n=5
)
info("✅ RAG 检索工具初始化成功")
info("✅ RAG 检索工具初始化成功(异步版本)")
return rag_tool
except Exception as e:
warning(f"⚠️ RAG 检索工具初始化失败: {e}")