11 个版本
0.2.1 | 2024年4月7日 |
---|---|
0.2.0 | 2024年4月4日 |
0.1.8 | 2024年3月28日 |
0.1.7 | 2023年4月16日 |
0.1.3 | 2022年12月29日 |
#400 在 命令行工具
每月下载 48 次
28KB
561 代码行
GPTO (Geppetto)
非官方 OpenAI 终端客户端
> gpto -h
A tiny unofficial OpenAI client
Usage: gpto [OPTIONS] <COMMAND>
Commands:
prompt The prompt(s) to generate completions for. Also accepts text from stdin
conversation
help Print this message or the help of the given subcommand(s)
Options:
-d, --disable-spinner Disable the spinner and message when querying
-s, --suffix <SUFFIX> Text to be appended to end of response [default: ]
-m, --model <MODEL> Text to be appended to end of response, defaults to gpt-3.5-turbo and can be set in config
-c, --config <CONFIG> Absolute path of configuration. Defaults to $XDG_CONFIG_HOME/gpto.cfg
-e, --endpoint <ENDPOINT> URL to be queried, defaults to https://api.openai.com and can be set in config
-t, --temperature <TEMPERATURE> What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer [default: 1]
-n, --number <NUMBER> How many completions to generate for each prompt [default: 1]
-a, --max-tokens <MAX_TOKENS> Maximum number of tokens to use for each request [default: 1000]
-i, --timeout <TIMEOUT> Maximum length of time in seconds to wait for an API request to complete
-o, --top-p <TOP_P> An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both [default: 1]
-h, --help Print help
-V, --version Print version
从 Crates.io 安装
# Linux and MacOS
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
安装 GTPO
cargo install gtpo
从 AUR 安装
# Use yay or another AUR helper
yay gpto-bin
从 GitHub 安装
克隆项目
git clone [email protected]:alanvardy/gpto.git
cd gpto
./test.sh # run the tests
cargo build --release
您可以在 /target/release/
中找到二进制文件
用法
使用默认参数获取补全
> gpto prompt --text "tell me a joke"
Q: What did the fish say when it hit the wall?
A: Dam!
使用来自 stdin 的文本获取补全(不显示加载指示器)
> echo "what is one plus one" | gpto prompt -d
Two
使用不同模型获取补全(此示例使用领先的代码补全模型)。是的,生成的代码并不符合规范!
有关模型的更多信息,请参阅 此处。此 CLI 应用程序使用 /v1/chat/completions
端点。
> gpto -m gpt-4 prompt -t language is elixir\nwrite a function that raises an error if the argument is not an integer and multiplies it by 2 if it is an integer
def multiply_by_two(x)
raise ArgumentError, "Argument is not an integer" unless x.is_a? Integer
x * 2
end
设置超时
默认超时为 30 秒,可以通过修改 gpto.cfg
中的 timeout
选项来更改。
依赖项
~12–25MB
~373K SLoC