Skip to content

Commit

Permalink
stdin and disable spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
alanvardy committed Apr 16, 2023
1 parent 9bcef56 commit 92ef0f0
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 95 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

## Unreleased

## 2023-04-16 0.1.7

- Disable spinners with env `DISABLE_SPINNER`
- Disable spinners with flag `x`
- `prompt` also accepts text from stdin

## 2023-04-05 0.1.6

Expand Down
54 changes: 27 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gpto"
version = "0.1.6"
version = "0.1.7"
authors = ["Alan Vardy <[email protected]>"]
edition = "2021"
license = "MIT"
Expand Down
48 changes: 11 additions & 37 deletions PUBLISH_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,31 @@ This checklist is just here for me to reduce the friction of publishing new vers

Code changes

1. Update dependencies and make sure nothing broke
1. Update dependencies and make sure nothing broke with `./update_test.sh`
2. Change the version in `Cargo.toml` and in this document (do a global find and replace)
3. Update CHANGELOG.md with the version number
4. Update README.md with help text `cargo run -- -h`
5. Add any new examples to README.md
6. Open PR for the version and wait for it to pass
7. Commit and merge PR

```bash
cargo update && \
./test.sh && \
./manual_test.sh
```

2. Revert the change to the test `gpto.cfg`
3. Change the version in `Cargo.toml` and in this document (do a global find and replace)
4. Update CHANGELOG.md with the version number
5. Update README.md with help text `cargo run -- -h`
6. Add any new examples to README.md
7. Open PR for the version and wait for it to pass
8. Commit and merge PR

9. Build release
8. Build release

```bash
git checkout main
git pull
cargo aur
```

10. [Create a new release](https://github.com/alanvardy/gpto/releases/new)
9. [Create a new release](https://github.com/alanvardy/gpto/releases/new)

- Make sure to use the label and title in format `v0.1.6`
- Add binary from gpto directory

11. Publish to Cargo
10. Publish to Cargo

```bash
cargo publish
```

12. Make sure we have the latest AUR git history

```bash
cd ../gpto-bin/
git pull
cd ../gpto/
```

13. Push to AUR

```bash
makepkg --printsrcinfo > ../gpto-bin/.SRCINFO
mv PKGBUILD ../gpto-bin/
rm *.tar.gz
cd ../gpto-bin/
git add .
git commit -m v0.1.6
git push aur
```
11. Push to aur with `./push_aur`
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,22 @@ A tiny unofficial OpenAI client
Usage: gpto [OPTIONS]

Options:
-p, --prompt <Prompt text>...
The prompt(s) to generate completions for
-p, --prompt [<Prompt text>...]
The prompt(s) to generate completions for. Also accepts text from stdin
-x, --disable spinner
Disable the spinner and message when querying
-c, --conversation [<Instructions to bot>...]
Start a conversation with an optional description of the bot's role
-s, --suffix <Text to be appended to end of response>...
The suffix that comes after a completion of inserted text. Defaults to an empty string
-t, --temperature <float>
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.
Defaults to 1.0
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. Defaults to 1.0
-n, --number <integer>
How many completions to generate for each prompt. Defaults to 1
-k, --top_p <float>
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.
Defaults to 1.0
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. Defaults to 1.0
-m, --model <model name>
Model to use for completion. Defaults to gpt-3.5-turbo.
This CLI uses the /v1/chat/completions endpoint,
see https://platform.openai.com/docs/models/gpt-3 for models available
Model to use for completion. Defaults to gpt-3.5-turbo. This CLI uses the /v1/chat/completions endpoint, see https://platform.openai.com/docs/models/gpt-3 for models available
-o, --config <path to config file>
Absolute path of configuration. Defaults to $XDG_CONFIG_HOME/gpto.cfg
-h, --help
Expand Down Expand Up @@ -95,6 +86,14 @@ Q: What did the fish say when it hit the wall?
A: Dam!
```
Get completions using text from stdin (without displaying the spinner)
```bash
> echo "what is one plus one" | gpto -xp
Two
```
Get a completion with a different model (this example uses the leading code completion model). And yes, the generated code is not idiomatic!
Read more about models [here](https://platform.openai.com/docs/models/gpt-3). This CLI app uses the `/v1/chat/completions` endpoint.
Expand Down
2 changes: 2 additions & 0 deletions manual_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ echo "== TESTING -p tell a great joke -t 0 ==" && \
cargo run -- -p tell a great joke -t 0 && \
echo "== TESTING -m gpt-3.5-turbo-0301 ==" && \
cargo run -- -m gpt-3.5-turbo-0301 -p language is elixir create a function that adds two numbers && \
echo "== TESTING -p with stdin ==" && \
echo "what is one plus one" | cargo run -- -xp && \
echo "== TESTING -c ==" && \
cargo run -- -c && \
echo "== TESTING -c Roleplay as Shakespeare ==" && \
Expand Down
12 changes: 12 additions & 0 deletions push_aur.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
cd ../gpto-bin/
git pull
cd ../gpto/
makepkg --printsrcinfo > ../gpto-bin/.SRCINFO
mv PKGBUILD ../gpto-bin/
rm *.tar.gz
cd ../gpto-bin/
git add .
git commit -m "new version"
git push aur
cd ../gpto
Loading

0 comments on commit 92ef0f0

Please sign in to comment.