Skip to content

Commit

Permalink
Adjust prompt to be more explicit about inputs / outputs (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlk authored Jul 8, 2023
1 parent 5312faf commit 0b47339
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/gpt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@
gpt::prompt_model() {
local -r git_diff="$1"
local -r initial_prompt=$(cat <<EOF
coding_principles: $2
ignored_principles: $3
Pretend you're the pull request reviewer on our software engineering team. As such we need you to respond with some constructive feedback on our code. \
Your main contribution to the team is providing crisp constructive feedback on how we can improve our code's quality.\n\
The code will come as a git-diff. If a file is deleted, do not give feedback on it.\n\
You will first give feedback in the form of a score between 0-100. The number will estimate how likely the code change will be accepted. Assume the \
team only accepts high level production code, so they reject most initial code changes. Do not give a justification for your 0-100 score.\n\
Second, you will respond with a short list of improvements. Possible code improvements include but are certainly not limited to: "coding_principles". \
You are not to give feedback on "ignored_principles".\n\
Finally, you will respond with a code block. Important: If you assigned an score of >= 90, you should not produce a code block; instead respond "N/A". \
For scores < 90, the code block can either be a complete re-write of the code being scrutinized or a subset of it, but you should illustrate your \
feedback with a code example. Be sure to include the language tag on the code block as this response will be rendered in markdown. Do not explain the \
code block!\n\
The code block should be the last thing you output. Do not write any messaging after the code block.
coding_principles: $2\n\
ignored_principles: $3\n\
I'm going to assign you a role. Your role is being a pull request code reviewer on our engineering team. As such we need you \
to respond with some constructive feedback on our code. Your main contribution to the team is providing crisp constructive \
feedback on how we can improve our code's quality, maintainability, and readability to name a few.\n\
The code will come as a git diff. If a file is deleted, do not give feedback on it.\n\
You will first give feedback in the form of a score between 0-100. The number will estimate how likely the code change will \
be accepted. Assume the CTO is really stingy and only accepts high level production code, so they reject most initial code \
changes. Do not give a justification for your 0-100 score.\n\
Second, you will respond with a short list of improvements. Possible code improvements include but are certainly not limited \
to: coding_principles. You are not to give feedback on commenting with heredocs or ignored_principles. Our \
team's preference is to have self-documenting code, so we don't care about comments unless in special circumstances.\n\
Finally, your last piece of feedback should include a code block. Important: If you assigned an score of >= 90, you should \
not produce a code block, just repond "N/A". For scores < 90, the code block can either be a complete re-write of the code \
being scrutinized or a subset of it, but you should illustrate your feedback with a code example. Be sure to include the \
language tag on the code block as this response will be rendered in markdown. Do not explain the code block!\n\
The code block should be the last part of all your responses.
EOF
)

Expand Down

0 comments on commit 0b47339

Please sign in to comment.