mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-08 04:23:35 +00:00
feat(knowledge): add reranking functionality for simple_assistant_agent and summary_assis_agent
- Implement reranking of retrieved chunks when needed - Improve relevance of search results by ranking chunks based on query
This commit is contained in:
@@ -111,6 +111,9 @@ class RetrieverResource(Resource[ResourceParameters]):
|
||||
if not question:
|
||||
raise ValueError("Question is required for knowledge resource.")
|
||||
chunks = await self.retrieve(question)
|
||||
if self.need_rerank and len(chunks) > 1:
|
||||
chunks = self.reranker.rank(candidates_with_scores=chunks, query=question)
|
||||
|
||||
prompt_template = """Resources-{name}:\n {content}"""
|
||||
prompt_template_zh = """资源-{name}:\n {content}"""
|
||||
if lang == "en":
|
||||
|
Reference in New Issue
Block a user