Function Calling Demo #416
Replies: 9 comments 3 replies
-
That's amazing. I've been playing with ways to integrate a llms into my task management workflow with task warrior as the local back end storage. It has a robust Python Library So I wouldn't be surprised If that was easy to implement with function calling plugin. Another thing that might be nice is a generic notes storage plugin with something like a sqlite backend. |
Beta Was this translation helpful? Give feedback.
-
Some updates on function calls. Today I was working to make it possible for LLM to keep executing functions until it will accomplish given task. For example if we ask LLM to execute some shell commands, and they might fail, it can refine the command based on exit code, stdout/stderr.
ExplanationFirst we asked LLM to get files in the directory, LLM handled it by simply calling ls /Users/user/somewhere Now when we have list of files in the conversation history, I asked LLM to convert sips -s format jpeg /Users/user/somewhere/*.png --out /Users/user/somewhere It didn't convert png files and ended with warning:
Since we are passing output of the shell command back to GPT-4, it responded back with following message:
Folowed by two more shell commands. sips -s format jpeg /Users/user/somewhere/test.png --out /Users/user/somewhere/test.jpg
sips -s format jpeg /Users/user/somewhere/test_1.png --out /Users/user/somewhere/test_1.jpg This time both
And it was executing shell commands one by one until it gets to the desired results. |
Beta Was this translation helpful? Give feedback.
-
Can this be configured to work with ollama? |
Beta Was this translation helpful? Give feedback.
-
wow amazing. Do you think this could be setup somehow as like an integration into n8n ? so that i could say type a command in slack then it would run on terminal in docker container somewhere? |
Beta Was this translation helpful? Give feedback.
-
This looks really powerful, but I don't want functions to be called immediately, I want to see them and confirm them first. Even in the example you gave, I might not want the AI to open up 300 tabs in my browser, for instance. |
Beta Was this translation helpful? Give feedback.
-
I definitely want it to work on its own. Would be cool to like search
Google with and feedback summaries, a scraper.
…On Thu, Apr 4, 2024, 9:58 AM endolith ***@***.***> wrote:
This looks really powerful, but I don't want functions to be called
immediately, I want to see them and confirm them first. Even in the example
you gave, I might not want the AI to open up 300 tabs in my browser, for
instance.
—
Reply to this email directly, view it on GitHub
<#416 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A66AEW6TDMVGCPTXB7KNEBLY3VTA3AVCNFSM6AAAAABBAWZ65SVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TAMJQHE2TO>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I love this feature. GPT4 and 4o seem to be very aware of GNOME and KDE settings so you can say "open the settings for monitor scaling" and it pops open. You can also say "switch to gnome dark mode" and it just does the setting for you, which is pretty cool. It might be nice, as an option, to open a non-interactive terminal so you can watch the command execute. That would let you know if its hung due to an error or still working. |
Beta Was this translation helpful? Give feedback.
-
Another potential improvement for functions would be a method to handle or avoid issues caused by interactive Bash programs that wait for user input. Prompts like "Are you sure?" will cause the function to hang because they don't return as finished while waiting for user interaction. From the README: The docstring comment inside the class will be passed to the OpenAI API as a description for the function, along with the title attribute and parameter descriptions. The execute function will be called if the LLM decides to use your function. In this case, we are allowing the LLM to execute any Shell commands in our system. Since we are returning the output of the command, the LLM will be able to analyze it and decide if it is a good fit for the prompt. Here is an example of how the function might be executed by the LLM: Based on this, I tried added a note to the docstring informing the model that the shell commands are non-interactive and should be formulated accordingly. This seemed to help, and I didn't encounter the issue again. Later, just for additional clarity, I added an example list of common flags to the reminder, which also seems to work, though I haven't tested it as extensively.
|
Beta Was this translation helpful? Give feedback.
-
Hey bro I love shell-gpt I use it everyday. I noticed with gpt4-o sometimes now it doesn't like to chain functions as much as predecessor. Also It got me thinking, is it possible to like have a predefined series of functions that could be executed? Like an automation of sorts? Would that even be useful I'm not sure but I'm picturing being able to make a basic webapp and save each separate file etc etc. like cloudflare cli using Wrangler for example, deploy a whole project etc. |
Beta Was this translation helpful? Give feedback.
-
Just wanted to share some progress on a feature I'm currently working function calling. I was surprised how many interesting things might be done using function calls.
sgpt_fn_calling_demo_lb.mp4
General idea is to implement some easy way to allow ShellGPT users to create custom functions for LLMs. I came up with the idea to create some kind of function "outline" Python class, which basically will describe a function for LLM with description, all parameters and the expecting output.
So here is some simplified workflow I came up with. ShellGPT has new "watch folder" which will store all functions
.py
files with some standardized Python classes. Before calling OpenAI, we are looking into folder, collecting the functions, and generating JSON schema to pass them to OpenAI when making request to the API. Simple example of a function class:Once we have it in our "watch folder" we can start using it right away, since ShellGPT will load them and pass to OpenAI API.
sgpt "provide last 5 links to PEP documentation and open them"
Output:
In general it open a whole new world of possibilities, for example if we have multiple shell commnds in the LLM output, it could execute them right away, and check the stdout/stderr and based on result take futher actions to complete the task.
Another example:
sgpt "play music"
Output:
(starts playing music in Apple Music according to the function class).
sgpt "what functions do you have?"
Output:
I would greatly appreciate your feedback and any ideas you might have on this concept. Your input could be valuable in refining and enhancing this feature. Please feel free to share your thoughts.
Beta Was this translation helpful? Give feedback.
All reactions