|
@@ -33,7 +33,8 @@ class FileSearchTool(BaseTool):
|
|
name: str = "file_search"
|
|
name: str = "file_search"
|
|
description: str = (
|
|
description: str = (
|
|
"Can be used to look up knowledge base information that was uploaded to this assistant."
|
|
"Can be used to look up knowledge base information that was uploaded to this assistant."
|
|
- + "If the user is referencing about specific content within files, that is often a good hint that information may be here."
|
|
|
|
|
|
+ + "If the user is retrieve specified content from the knowledge base or file system, that is often a good hint that information may be here."
|
|
|
|
+ + "Retrieve content from files or knowledge base (similar to database lookup, document search, or information fetching)"
|
|
+ "## Input Requirements:"
|
|
+ "## Input Requirements:"
|
|
+ "The prompt must return a strictly standard JSON object! Absolutely no code blocks, comments, or extra symbols. Example format: {'query': 'query to look up in retrieval'}"
|
|
+ "The prompt must return a strictly standard JSON object! Absolutely no code blocks, comments, or extra symbols. Example format: {'query': 'query to look up in retrieval'}"
|
|
+ "Singleton operation: Strictly 1 invocation per API call"
|
|
+ "Singleton operation: Strictly 1 invocation per API call"
|
|
@@ -75,21 +76,6 @@ class FileSearchTool(BaseTool):
|
|
for file in files:
|
|
for file in files:
|
|
self.__keys.append(file.key)
|
|
self.__keys.append(file.key)
|
|
print(files)
|
|
print(files)
|
|
- # r2r接口不提供多条件,否则上面没必要存在
|
|
|
|
- """
|
|
|
|
- if len(document_id) > 0:
|
|
|
|
- filesinfo += FileService.list_in_files(ids=document_id, offset=0, limit=100)
|
|
|
|
- # asyncio.run(
|
|
|
|
- # FileService.list_in_files(ids=document_id, offset=0, limit=100)
|
|
|
|
- # )
|
|
|
|
- for file in filesinfo:
|
|
|
|
- self.__filenames.append(file.get("title"))
|
|
|
|
- self.__keys.append(file.get("id"))
|
|
|
|
- print(filesinfo)
|
|
|
|
- """
|
|
|
|
-
|
|
|
|
- # files = FileService.list_in_files(ids=run.file_ids, offset=0, limit=100)
|
|
|
|
-
|
|
|
|
# 读取assistant的数据,获取文件夹的id
|
|
# 读取assistant的数据,获取文件夹的id
|
|
db_asst = AssistantService.get_assistant_sync(
|
|
db_asst = AssistantService.get_assistant_sync(
|
|
session=session, assistant_id=run.assistant_id
|
|
session=session, assistant_id=run.assistant_id
|
|
@@ -106,29 +92,12 @@ class FileSearchTool(BaseTool):
|
|
# folder_fileinfo = []
|
|
# folder_fileinfo = []
|
|
if asst_folder_ids:
|
|
if asst_folder_ids:
|
|
self.__dirkeys = asst_folder_ids
|
|
self.__dirkeys = asst_folder_ids
|
|
- """
|
|
|
|
- for fid in asst_folder_ids:
|
|
|
|
- folder_fileinfo += FileService.list_documents(
|
|
|
|
- id=fid, offset=0, limit=100
|
|
|
|
- )
|
|
|
|
- # folder_fileinfo += asyncio.run(
|
|
|
|
- # FileService.list_documents(id=fid, offset=0, limit=100)
|
|
|
|
- # )
|
|
|
|
- print(folder_fileinfo)
|
|
|
|
- for file in folder_fileinfo:
|
|
|
|
- self.__filenames.append(file.get("title"))
|
|
|
|
- self.__keys.append(file.get("id"))
|
|
|
|
- """
|
|
|
|
|
|
+
|
|
# pre-cache data to prevent thread conflicts that may occur later on.
|
|
# pre-cache data to prevent thread conflicts that may occur later on.
|
|
print(
|
|
print(
|
|
"---------ssssssssssss-----------------sssssssssssss---------------ssssssssssssss-------------sssssssssssss-------------ss-------"
|
|
"---------ssssssssssss-----------------sssssssssssss---------------ssssssssssssss-------------sssssssssssss-------------ss-------"
|
|
)
|
|
)
|
|
print(self.__dirkeys)
|
|
print(self.__dirkeys)
|
|
- """
|
|
|
|
- for file in files:
|
|
|
|
- self.__filenames.append(file.filename)
|
|
|
|
- self.__keys.append(file.key)
|
|
|
|
- """
|
|
|
|
print(self.__keys)
|
|
print(self.__keys)
|
|
|
|
|
|
# indexes: List[int],
|
|
# indexes: List[int],
|