*nix 系统的自然语言 shell 接口。
Orphic 是一个 CLI 工具,它使用 GPT 将复杂的任务转换为要在系统上执行的 shell 命令。它擅长处理相对简单但需要复杂且晦涩的命令才能完成的任务。
$ orphic delete all installers or tars from ~/Downloads that are more than a week old
find ~/Downloads -name '*.tar.*' -mtime +7 -delete; find ~/Downloads -name '*.dmg' -mtime +7 -delete
Execute? [Y/n] Y
注意:Orphic 默认为安全模式,除非指定非安全模式,否则不会在未经确认的情况下自动执行命令。
cargo install orphic
OPENAI_API_KEY
环境变量。您可以在此处生成一个。Orphic 的使用方式就像使用任何其他 CLI 工具一样。
$ orphic sort ~/Downloads into folders based on media type
$ orphic how strong is my network connection
$ orphic what version kernel am i running
$ orphic show me the name and size of all files larger than 8MB in ~/Downloads/
$ orphic <do task that would otherwise require complex commands that you don't know off the top of your head>
-u
或--unsafe
将执行命令而无需用户验证。
-4
或--gpt4
将尝试使用 GPT-4 而不是 GPT-3.5-Turbo。请注意,只有当您的 OpenAI 帐户有权访问该模型时,这才有效。
-i
或--interpret
将以自然语言描述任务的输出(请注意,这通常非常慢)。
$ orphic -u -i how much disk space is available
You have 16GB available out of a total of 113GB on your main hard
drive, which is mounted on the root directory.
Other partitions and file systems are also listed with their
respective usage percentages and mount points.
-d
或--debug
将显示原始 GPT 文本以及常规输出,即使在不安全模式下也是如此。
$ orphic -u -d count the lines of rust code in this directory excluding /target/.
{"command": "find . -name target -prune -o -name '*.rs' -type f -print0 | xargs -0 wc -l"}
61 ./src/prompts.rs
219 ./src/main.rs
280 total
-r
或--repl
将在 REPL 环境中启动 Orphic。
$ orphic -u -r
orphic> when did i last login
wtmp begins Sat Mar 18 14:55
orphic> quit
$
有时奥菲斯会起作用。有时则不然。 GPT 不一致,而且我使用的提示还有很多不足之处。如果将任务格式化为命令而不是问题(“列出当前打开的端口”而不是“当前打开的端口”),结果似乎会更好。经常出现的错误是 GPT 将尝试使用不同操作系统/发行版的命令或软件包,或者尝试使用您当前未安装的工具。如果您认为该任务需要特定于操作系统的工具,一个快速解决方法是指定您的操作系统,但我正在努力让 Orphic 更加了解哪些命令可以使用,哪些命令不能使用。
欢迎拉请求。如果您使用 Orphic 并获得良好/有趣的输出,请将其发送给我。同样,如果你得到的输出非常糟糕,也请将其发送给我或提出问题。这个系统是非常实验性的,我仍在尝试找出在提示和配置方面什么有效,什么无效。
麻省理工学院
版权所有 (c) 威尔·萨维奇,2023