|
@@ -27,21 +27,11 @@ class FileSearchToolInput(BaseModel):
|
|
|
class FileSearchTool(BaseTool):
|
|
|
name: str = "file_search"
|
|
|
description: str = (
|
|
|
- "当遇到以下情况时,你必须直接调用[filesearch]工具:"
|
|
|
- + "1. 用户需要从文件/文档中检索具体内容"
|
|
|
- + "2. 涉及查找数据、条款或技术细节"
|
|
|
- + '3. 明确出现"搜索文档"、"查找文件"等指令'
|
|
|
- + "调用规范:"
|
|
|
- + "1. 自动从对话中提取以下参数:"
|
|
|
- + ' - query: "The keyword or phrase to search for, supporting exact matches."'
|
|
|
- + "2. 严格使用JSON格式发起函数调用:"
|
|
|
- + "```json"
|
|
|
- + "{"
|
|
|
- + ' "tool": "filesearch",'
|
|
|
- + ' "parameters": {'
|
|
|
- + ' query:"The keyword or phrase to search for, supporting exact matches."'
|
|
|
- + " }"
|
|
|
- + "}"
|
|
|
+ "This tool must be called when the question involves the following situations:"
|
|
|
+ + " - Asking for specific content in files/documents"
|
|
|
+ + " - Need to find data, terms, or technical details"
|
|
|
+ + ' - The user explicitly requests "search files" or "search materials"'
|
|
|
+ "Retrieves content from specified files based on the keywords or phrases requested above, returning matching text snippets."
|
|
|
)
|
|
|
|
|
|
args_schema: Type[BaseModel] = FileSearchToolInput
|
|
@@ -158,11 +148,21 @@ class FileSearchTool(BaseTool):
|
|
|
self.__dirkeys and len(self.__dirkeys) > 0
|
|
|
):
|
|
|
return (
|
|
|
- "You can use the 'retrieval' tool in the following situations:"
|
|
|
- + "When you need to find specific content from a file or document."
|
|
|
- + "When searching for data, clauses, or technical details."
|
|
|
- + "When the user explicitly requests to 'search a document' or 'search for information.'"
|
|
|
- + "To proceed with a search, please provide more details about the specific file you're looking for and the keywords or information you need to find. This will allow me to perform a search and return the relevant content for you!"
|
|
|
+ "当遇到以下情况时,你必须直接调用[filesearch]工具:"
|
|
|
+ + "1. 用户需要从文件/文档中检索具体内容"
|
|
|
+ + "2. 涉及查找数据、条款或技术细节"
|
|
|
+ + '3. 明确出现"搜索文档"、"查找文件"等指令'
|
|
|
+ + "调用规范:"
|
|
|
+ + "1. 自动从对话中提取以下参数:"
|
|
|
+ + ' - query: "The keyword or phrase to search for, supporting exact matches."'
|
|
|
+ + "2. 严格使用JSON格式发起函数调用:"
|
|
|
+ + "```json"
|
|
|
+ + "{"
|
|
|
+ + ' "tool": "filesearch",'
|
|
|
+ + ' "parameters": {'
|
|
|
+ + ' query:"The keyword or phrase to search for, supporting exact matches."'
|
|
|
+ + " }"
|
|
|
+ + "}"
|
|
|
)
|
|
|
else:
|
|
|
return ""
|