res = execute_bash_command('whoami --help')print(res)
Usage: whoami [OPTION]...
Print the user name associated with the current effective user ID.
Same as id -un.
--help display this help and exit
--version output version information and exit
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/whoami>
or available locally via: info '(coreutils) whoami invocation'
Simulated GPT workflow
Test integrating this into current GPT framework with multiple commands:
from llmcam.core.fc import*from llmcam.core.fn_to_schema import function_schematools = [function_schema(execute_bash_command)]
messages = form_msgs([ ("system", "You are a helpful system administrator. Use the supplied tools to assist the user."), ("user", "Show the disk usage with bash command"), ])complete(messages, tools=tools)
messages.append(form_msg("user", "show the system info with bash command"))complete(messages, tools=tools)
('assistant',
"Here's the system information:\n\n```\nLinux e15 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux\n```\n\nThis output includes the kernel name (`Linux`), the hostname (`e15`), the kernel version (`6.8.0-49-generic`), the architecture (`x86_64`), and other system details related to your current Ubuntu setup.")
messages.append(form_msg("user", "tell current directory with bash command"))complete(messages, tools=tools)
('assistant', 'The current directory is:\n\n```\n/home/doyu/00llmcam/nbs\n```')
messages.append(form_msg("user", "list files under ../data with bash command"))complete(messages, tools=tools)
('assistant',
'Here are the files under the `../data` directory:\n\n- `cap_2024.09.28_15:59:06_Presidentinlinna.jpg`\n- `cap_2024.09.28_16:00:11_Presidentinlinna.jpg`\n- `cap_2024.09.28_16:01:16_Etelasatama.jpg`\n- `cap_2024.09.28_16:02:21_Etelasatama.jpg`\n- `cap_2024.09.28_16:05:31_Olympiaterminaali.jpg`\n- `cap_2024.09.28_16:06:36_Olympiaterminaali.jpg`\n- `cap_2024.09.28_16:07:41_Torni.jpg`\n- `cap_2024.09.28_16:09:51_Tuomiokirkko.jpg`\n- `cap_2024.09.28_16:15:11_Presidentinlinna.jpg`\n- `cap_2024.09.28_17:33:31_Presidentinlinna.jpg`\n- ... (and many more)\n\nIf you need to see a specific part of the list or need further details, please let me know!')
messages.append(form_msg("user", "rename cap_2024.09.28_15:59:06_Presidentinlinna.jpg with xcap_2024.09.28_15:59:06_Presidentinlinna.jpg with bash command"))complete(messages, tools=tools)
('assistant',
'The file has been successfully renamed from `cap_2024.09.28_15:59:06_Presidentinlinna.jpg` to `xcap_2024.09.28_15:59:06_Presidentinlinna.jpg`.')
messages.append(form_msg("user", "check if there's xcap_2024.09.28_15:59:06_Presidentinlinna.jpg with bash command"))complete(messages, tools=tools)
('assistant',
'The file `xcap_2024.09.28_15:59:06_Presidentinlinna.jpg` does exist in the `../data` directory.')
messages.append(form_msg("user", "show some of the running processes with bash command"))complete(messages, tools=tools)
('assistant',
'Here are some of the running processes:\n\n```\nUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND\nroot 1 0.0 0.0 167064 12084 ? Ss Nov30 0:03 /sbin/init splash\nroot 2 0.0 0.0 0 0 ? S Nov30 0:00 [kthreadd]\nroot 3 0.0 0.0 0 0 ? S Nov30 0:00 [pool_workqueue_release]\nroot 4 0.0 0.0 0 0 ? I< Nov30 0:00 [kworker/R-rcu_g]\nroot 5 0.0 0.0 0 0 ? I< Nov30 0:00 [kworker/R-rcu_p]\nroot 6 0.0 0.0 0 0 ? I< Nov30 0:00 [kworker/R-slub_]\nroot 7 0.0 0.0 0 0 ? I< Nov30 0:00 [kworker/R-netns]\nroot 10 0.0 0.0 0 0 ? I< Nov30 0:00 [kworker/0:0H-events_highpri]\nroot 12 0.0 0.0 0 0 ? I< Nov30 0:00 [kworker/R-mm_pe]\n```\n\nThis output includes the user, process ID (PID), CPU and memory usage, process status, and the command that initiated the process.')
messages.append(form_msg("user", "list only those process ids"))complete(messages, tools=tools)
('assistant',
'Here are some of the process IDs (PIDs) of running processes:\n\n```\n1\n2\n3\n4\n5\n6\n7\n10\n12\n13\n```')
messages.append(form_msg("user", "What kind of Openrating System is running?"))complete(messages, tools=tools)
('assistant',
'The operating system running is a version of Linux, specifically:\n\n```\nUbuntu, with Linux kernel version 6.8.0-49-generic\n```\n\nThis information indicates that the machine is running Ubuntu as its operating system.')
messages.append(form_msg("user", "Capture the desktop image"))complete(messages, tools=tools)
('assistant',
"It seems there was an error trying to capture the desktop image. The tool could not access the X Window system, possibly due to the environment in which it's running, which may not support direct graphical access or the X server is not available.\n\nIf you are running in a headless environment or without a graphical interface, this could lead to such errors. Let me know if there's anything else you need help with!")
('assistant',
'The `scrot` package is already installed and is the newest version available. You can use it to capture screenshots. If you need further assistance with capturing the screen using `scrot`, feel free to ask!')
messages.append(form_msg("user", "Capture the desktop image"))complete(messages, tools=tools)
('assistant',
'The desktop image has been successfully captured and saved as `desktop_capture.png` in the `../data` directory.')
('assistant',
'The `scrot` package has been successfully uninstalled from your system. If you wish to clean up other packages that were automatically installed with `scrot` and are no longer needed, you can run `sudo apt autoremove`. If you need further assistance, feel free to ask!')