AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Add support for more filters to search_files()

Open oppiet30 opened this issue 2 years ago • 8 comments

NEXT ACTION: COMMAND = search_files ARGUMENTS = {'directory': '/', 'query': 'liabilities'} Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ... Input:y -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-= SYSTEM: Command search_files returned: Error: search_files() got an unexpected keyword argument 'query'

oppiet30 avatar Apr 21 '23 15:04 oppiet30

Same error on my end

SherifG97 avatar Apr 22 '23 00:04 SherifG97

Same:

NEXT ACTION:  COMMAND = search_files ARGUMENTS = {'directory': './', 'query': '*.pdf'}
SYSTEM:  Command search_files returned: Error: search_files() got an unexpected keyword argument 'query'

I have seen the error previously, but with 'extension' rather than 'query'

NEXT ACTION:  COMMAND = search_files ARGUMENTS = {'directory': './', 'extension': 'pdf'}
Input:Please check your search_file() command. You received an error: search_files() got an unexpected keyword argument 'extension'

This is certainly a bit fishy as 'extension' doesn't appear much at all within the codebase.

I would also note that the seems to be some references to "search_file(" (singular) in these error messages, but sometimes it is plural.

I really don't understand this.. the search_files config seems to clearly state only 1 argument:

@command("search_files", "Search Files", '"directory": "<directory>"')
def search_files(directory: str) -> list[str]:
    """Search for files in a directory

    Args:
        directory (str): The directory to search in

    Returns:
        list[str]: A list of files found in the directory
    """
    found_files = []

    if directory in {"", "/"}:
        search_directory = WORKSPACE_PATH
    else:
        search_directory = path_in_workspace(directory)

    for root, _, files in os.walk(search_directory):
        for file in files:
            if file.startswith("."):
                continue
            relative_path = os.path.relpath(os.path.join(root, file), WORKSPACE_PATH)
            found_files.append(relative_path)

    return found_files

Update, AutoGPT can be told to not use the extra argument:

Pardon my typos...

image

Brian-Webster avatar Apr 22 '23 04:04 Brian-Webster

Seems like sometimes it'll work through it. Most often I see it making up names for the files its looking for or adding duplicate destination directories. Sometimes i'll just create the bullshit path it's looking for and it'll find it and end the error loop :) I know i'm an enabler.

sid-newby avatar Apr 22 '23 04:04 sid-newby

looks like a prompting issue. Kinda funky though. Reopen if it keeps happening with different prompts

ntindle avatar Apr 22 '23 09:04 ntindle

image

I am having the same issue consistently, independent of prompt. Using a prompt proven functional by another user still sometimes triggers this problem.

GPT 3.5

deWaardt avatar Apr 24 '23 20:04 deWaardt

@ntindle I am encountering this issue also.

I have the latest code at sha 7a161cc0bd8253759c8e7b15c0a3e3d86f0adbad

I'm incredibly new to AutoGPT, but whatever I can do to help debug this I'm all yours.

nachtien avatar Apr 27 '23 16:04 nachtien

Okay seems it's hallucinating other potential parameters for this. If any of y'all code, may as well add them as optional

ntindle avatar Apr 27 '23 16:04 ntindle

I got mine to continue by moving the in-work file output out of 'auto_gpt_workspace' into another folder

4republic avatar May 02 '23 14:05 4republic

This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days.

github-actions[bot] avatar Sep 06 '23 21:09 github-actions[bot]

This issue was closed automatically because it has been stale for 10 days with no activity.

github-actions[bot] avatar Sep 17 '23 01:09 github-actions[bot]