|
@@ -107,7 +107,7 @@ class RAGChatAgent:
|
|
|
return response
|
|
|
|
|
|
@staticmethod
|
|
|
- def select_prompt(chat_res, search_res):
|
|
|
+ def make_decision_prompt(chat_res, search_res):
|
|
|
# 创建一个 prompt 请求给大模型
|
|
|
prompt = f"""
|
|
|
这是一个问题的回答任务,以下是两个来源的结果:
|
|
@@ -123,21 +123,23 @@ class RAGChatAgent:
|
|
|
答案: {search_res["answer"]}
|
|
|
来源: {search_res["source"]}
|
|
|
状态: {"可以回答" if search_res["status"] == 1 else "无法回答"}
|
|
|
-
|
|
|
- 基于这两个结果,请你综合判断并生成一个更好的答案,如果可能的话。你可以选择结合 `chat_res` 和 `search_res`,或者选择其中更合适的一个进行回答。如果没有足够的信息可以回答,请用你自己已有的知识回答"。
|
|
|
|
|
|
- 请返回以下格式的 JSON 结果:
|
|
|
+ 基于这两个结果,请你综合判断并生成一个更好的答案,如果可能的话。你可以选择结合 `chat_res` 和 `search_res`,或者选择其中更合适的一个进行回答。如果没有足够的信息可以回答,请用你自己已有的知识回答"。
|
|
|
+ 基于回答的结果,总结回答的答案中使用的工具,名称以及用途,如果没有涉及到工具的使用,则不需要总结
|
|
|
+
|
|
|
+ 请返回以下格式的 JSON 结果:
|
|
|
{{
|
|
|
"result": "<最终的答案,输出markdown格式>",
|
|
|
"relevance_score": <0到1之间的小数,表示总结与问题的相关度>,
|
|
|
- "status": <1代表回答的好,0代表回答的不好>
|
|
|
+ "status": <1代表回答的好,0代表回答的不好>,
|
|
|
+ "used_tools": ["工具名1: 用途描述", "工具名2: 用途描述"]
|
|
|
}}
|
|
|
"""
|
|
|
|
|
|
return prompt
|
|
|
|
|
|
async def make_decision(self, chat_res, search_res):
|
|
|
- prompt = self.select_prompt(chat_res, search_res)
|
|
|
+ prompt = self.make_decision_prompt(chat_res, search_res)
|
|
|
response = await fetch_deepseek_completion(
|
|
|
model="DeepSeek-R1", prompt=prompt, output_type="json"
|
|
|
)
|