feat: rerank 模型使用

This commit is contained in:
李如威 2025-07-10 00:41:44 +08:00
parent 2a9654a65f
commit 7807866a37
1 changed files with 2 additions and 1 deletions

View File

@ -26,7 +26,7 @@ class AsyncRAGService:
)
self.rerank_llm = ChatOpenAI(
model="deepseek-r1:8b",
model="dengcao/Qwen3-Reranker-8B:Q3_K_M",
temperature=0.7,
openai_api_key=self.openai_api_key,
openai_api_base=self.openai_api_base,
@ -233,6 +233,7 @@ class AsyncRAGService:
)
try:
response = await asyncio.to_thread(self.rerank_llm.invoke, prompt)
self.logger.info(f"rerank 评分: {response.content.strip()} for {result['metadata']['filename']}")
score = float(response.content.strip())
return max(0.0, min(score, 1.0))
except Exception as e: