please icon indicating copy to clipboard operation
please copied to clipboard

Improve the default prompt template

Open 12joan opened this issue 2 years ago • 0 comments

OpenAI Codex has changed a lot since I first released this package. It's possible that the examples in the default prompt can be changed to improve the accuracy of completions.

By adding --show-prompt to the command, you can perform a dry run without sending anything to OpenAI.

The relevant source files are ./lib/please/request.rb and ./lib/please/context.rb.

Current default prompt
Write a one-line bash command for each of the following tasks.

# Find all files older than 1 week and open each of them in vim
$ find . -type f -mtime +7 -exec vim {} \;

# Show a clock which updates every second on a single line
$ printf 'import time\nwhile True:\n\tprint(time.strftime("%%H:%%M:%%S"), end="\\r")\n\ttime.sleep(1)' > /tmp/program.py; python3 /tmp/program.py; rm /tmp/program.py

# Write a python program that prints out hello world with each letter on its own line
$ printf 'print("\\n".join(list("Hello World"))' > /tmp/program.py; python3 /tmp/program.py; rm /tmp/program.py

# Read from stdin until EOF, and then output the length of the string
$ printf 'import sys\nprint(len(sys.stdin.read().strip()))' > /tmp/program.py; python3 /tmp/program.py; rm /tmp/program.py

# Run the fortune command 5 times
$ for i in $(seq 5); do fortune; done

# Repeadedly read a single line from the user, reverse it, and print it back
$ printf 'while True:\n\tline = input()\n\tprint(line[::-1])' > /tmp/program.py; python3 /tmp/program.py; rm /tmp/program.py

# Print the current working directory
$ pwd
/app

# Show information about the operating system
$ uname -a
Linux 5cd48dff0cd9 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 GNU/Linux

# List all files in the current directory
$ ls -a
.
..
.env
.env.example
.git
.gitignore
.rubocop.yml
Dockerfile
Gemfile
Gemfile.lock
LICENSE.txt
README.md
Rakefile
bin
docker-compose.yml
exe
lib
please.gemspec
test


# say hello
$

12joan avatar Jan 13 '23 23:01 12joan