jack 1 month ago
parent
commit
fbb216f9f1
1 changed files with 16 additions and 6 deletions
  1. 16 6
      app/core/tools/file_search_tool.py

+ 16 - 6
app/core/tools/file_search_tool.py

@@ -145,12 +145,22 @@ class FileSearchTool(BaseTool):
             self.__dirkeys and len(self.__dirkeys) > 0
         ):
             return (
-                '当用户使用以下动词时,必须调用 "retrieval" tool: '
-                + "- 搜索/查找/检索/调取/查看/找/有没有..."
-                + "输入格式:  "
-                + "{"
-                + '  "query": "用户问题中的关键词",'
-                + "}"
+                "## 工具使用规范"
+                + "可调用工具:"
+                + "- retrieval:用于在文件库中搜索与问题相关的具体内容"
+                + "**调用规则**:"
+                + "1. 当问题涉及以下情况时必须调用本工具:"
+                + "   - 询问文件/文档中的具体内容"
+                + "   - 需要查找数据、条款或技术细节"
+                + '   - 用户明确要求"查文件"或"搜索资料"'
+                + "2. 调用时需遵循:"
+                + "   ```json"
+                + "   {"
+                + '     "action": "retrieval",'
+                + '     "action_input": {'
+                + '       "query": "精炼后的搜索语句,需包含至少2个关键要素(用户问题的原始上下文)"'
+                + "     }"
+                + "   }"
             )
         else:
             return ""