mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-05 13:52:38 +02:00
feat: +similarity_search
This commit is contained in:
parent
12d643ab3d
commit
513d1317d6
4 changed files with 26 additions and 5 deletions
|
|
@ -937,15 +937,16 @@ class Editor(BaseModel):
|
|||
|
||||
@staticmethod
|
||||
async def similarity_search(query: str, file_or_path: Union[str, Path]) -> List[str]:
|
||||
"""Performs a similarity search for a given query across specified files or paths.
|
||||
"""Given a filename or a pathname, performs a similarity search for a given query across the specified file or path.
|
||||
|
||||
This method searches the index repository for the provided query, classifying the specified
|
||||
files or paths. It performs a search on each cluster of files and handles non-indexed files
|
||||
separately, merging results from structured indices with any direct results from non-indexed files.
|
||||
This function call does not depend on other functions.
|
||||
|
||||
Args:
|
||||
query (str): The search query string to look for in the indexed files.
|
||||
file_or_path (Union[str, Path]): A path or filename to search within.
|
||||
file_or_path (Union[str, Path]): A pathname or filename to search within.
|
||||
|
||||
Returns:
|
||||
List[str]: A list of results as strings, containing the text from the merged results
|
||||
|
|
@ -953,7 +954,7 @@ class Editor(BaseModel):
|
|||
|
||||
Example:
|
||||
>>> query = "The problem to be analyzed from the document"
|
||||
>>> file_or_path = "The document or folder you want to query"
|
||||
>>> file_or_path = "The pathname or filename you want to search within"
|
||||
>>> texts: List[str] = await Editor.similarity_search(query=query, file_or_path=file_or_path)
|
||||
>>> print(texts)
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue