Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function Calling: unexpected behavior within ShellGPT's REPL mode when using the --repl --shell options #485

Closed
hcal opened this issue Feb 19, 2024 · 3 comments · Fixed by #525
Labels
bug Something isn't working

Comments

@hcal
Copy link

hcal commented Feb 19, 2024

I've encountered a potential issue or unexpected behavior with ShellGPT's REPL mode when using the --repl --shell options. I'm not 100% sure if this is a bug or if I'm not using the feature correctly.

Issue Description

When using the sgpt --repl --shell command and then asking it to list files in the current directory, the command's behavior is inconsistent between executions. Initially, the command executes but does not produce any output. Repeating the same command immediately after results in the expected output being displayed.
Steps to Reproduce

Start ShellGPT in REPL mode with the shell option: sgpt --repl --shell
Input the command: list files in this dir
Entering REPL mode, press Ctrl+C to exit.
>>> list files in this dir

> @FunctionCall `execute_shell_command(shell_command="ls -l")`

>>> list files in this dir
Here is the list of files and directories in the current directory:
total 388
drwxr-xr-x. 1 cal cal    554 Feb 15 10:24 bin
drwxr-xr-x. 1 cal cal     28 Jan 13 16:35 blog
drwxr-xr-x. 1 cal cal      0 Feb 15 09:54 Desktop
drwxr-xr-x. 1 cal cal    880 Feb 15 09:15 Documents

Note the command I issued 'list files in this dir' twice and how the first time didn't product output following the "@functioncall" notice.

Expected Behavior

I expected the command run a function and list the files and directories upon the first execution without needing to repeat the command for output.

Actual Behavior

The command needs to be executed twice to produce the expected output. The first execution runs the function without any visible output, and the second execution displays the correct information without seemingly running the function again.
Additional Information

I observed similar behavior with other commands that produce output, such as interactions with Task Warrior, which worked impressively well without additional configuration.

Is this behavior a bug, or am I missing a step in setting up or using the --repl --shell mode incorrectly?

@TheR1D
Copy link
Owner

TheR1D commented Feb 20, 2024

This is actually a bug, --shell should not have access to functions. It is not particularly useful in the context of generating pure shell commands. Functions should only work with the default and custom roles. I tested it with default role sgpt --repl temp, and it works as expected. We will remove function calls from repl --shell/code in upcoming releases.

@TheR1D TheR1D added the bug Something isn't working label Feb 20, 2024
@ghost
Copy link

ghost commented Mar 24, 2024

in powershell, it acts as follows:

>>> what is current folder?
```powershell
Get-Location

e

powershell : The term 'powershell' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  •   + CategoryInfo          : ObjectNotFound: (`powershell:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

@save196
Copy link
Contributor

save196 commented Mar 27, 2024

I attempted to replicate the issue using the command from the initial comment. It appears that --shell used immediately after --repl is just creating a session called "--shell".
Instead, the issue seems to be broader and occurs whenever the --chat or --repl flags are used and a function is called. sgpt outputs the function string, but then it doesn't manage to output the expected answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants