Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original Project Objective
Often times we want to execute the Gorilla command on a VM on behalf of the user. As a first step, can you build a "sandbox" that can execute a python function? Any function of your choice!
Container vs VM
VM is better in terms of future development and privacy concerns. I do believe this one can also be achieved by Docker, and it was suggested in PR #52. This VM approach is showcasing an alternative way of solving problems. Notice that this approach does not confine within gorilla-cli, if you want, you can drag any python files into the folder to run it.
Usage Requirements
MacOS with M-series Chips and
qemu
installed. VM may work on windows or linux, but untested.Highlights:
Customizable CPU, RAM, and VM OS's. Automatic python virtual environment creation.
Usage
Visualized and concrete examples are shown in
VM_README.md
. Link here : https://github.com/gorilla-llm/gorilla-cli/blob/3b463bc14a7a8c056c0d0e48a97bc34cf49f2c58/VM_README.mdMethodology
It creates an object
overseer
to process all requests from sandboxes' requests and internally invokeslima
to generate corresponding virtual machine.Future improvements
More rigorous policies of overseer should be enforced to prevent internal safety hazards.
Linux images could be more refined to suit the need.
Only one sandbox is allowed to execute each time, and this may prohibit potential racing conditions between two sandboxes. Also, running multiple sandboxes at the same is resource consuming, and I would suggest to use one sandbox for all relevant files.
Edits:
The original
fcntl.ioctl
function is replaced byos.write
function in functionprefill_shell_cmd
ofgo_cli.py
. The latter one ensures that cmd can be actually written to VM terminals on archlinux. As discussed on https://bbs.archlinux.org/viewtopic.php?id=283932, archlinux imposes some restrictions on thefcntl.ioctl
.