Skip to content

Commit cae4ef6

Browse files
committed
better prompting
1 parent 92ce44e commit cae4ef6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

misc/claude

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ curl -Ss https://api.anthropic.com/v1/messages \
2020
"model": "claude-3-5-sonnet-20240620",
2121
"max_tokens": 1000,
2222
"messages": [
23-
{"role": "user", "content": "Please analyze the following coding problem prompt and return a structured JSON response with an array of the example inputs; each example should have a key called example (the exact text from the problem with NOTHING else) and a key called solution (a single number). If there are multiple examples in one part of the problem, use the LAST one. If the problem only has one part, there should only be one element in the array. If the problem has a part one and a part two, there should be two elements. Respond ONLY with the top-level JSON array, NO nested keys in the response object, no additional text.\n\n'"$PROMPT"'"}
23+
{"role": "user", "content": "Please analyze the following coding problem prompt and return a structured JSON response with an array of the example inputs; each example should have a key called example (the exact text from the problem with NOTHING else; this will almost certainly be tone entire contents inside of a <pre><code></code></pre> tag) and a key called solution (a single number). If there are multiple examples in one part of the problem, use the LAST one. If the problem only has one part, there should only be one element in the array. If the problem has a part one and a part two, there should be two elements. Respond ONLY with the top-level JSON array, NO nested keys in the response object, no additional text.\n\n'"$PROMPT"'"}
2424
],
2525
"temperature": 0.0
2626
}'

start

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ fetch_examples() {
1717

1818
while IFS= read -r line; do
1919
printf "\n\n\n%s" "$line" &> /dev/stderr
20-
EXAMPLE="$(echo "$line" | jq -r '.example')"
20+
echo "$line" | jq -r '.example' > sample${INDEX}.txt
2121
SOLUTION="$(echo "$line" | jq -r '.solution')"
22-
printf "%s\n" "$EXAMPLE" > sample${INDEX}.txt
2322
printf "%s" "$SOLUTION" > solution${INDEX}.txt
2423
((INDEX++))
2524
done < <(cat puzzle.html | pup 'article' | ~/aoc/misc/claude | tee /dev/stderr | jq -r '.content[0].text' | jq -rc '.[]')
@@ -38,7 +37,7 @@ start_part_2() {
3837
tmux send-keys "~/aoc/test-runner $YEAR $DAY 2" Enter
3938
tmux select-pane -t top-right
4039
tmux send-keys C-c
41-
tmux send-keys "~/aoc/misc/browser $YEAR $DAY 1" Enter
40+
tmux send-keys "~/aoc/misc/browser $YEAR $DAY" Enter
4241
tmux select-pane -t left
4342
}
4443

@@ -68,7 +67,7 @@ tmux send-keys "cd ~/aoc/$YEAR/$DIR" Enter
6867
tmux send-keys "~/aoc/misc/browser $YEAR $DAY" Enter
6968
tmux split-window -v
7069
tmux send-keys "cd ~/aoc/$YEAR/$DIR" Enter
71-
tmux send-keys "~/aoc/test-runner $YEAR $DAY" Enter
70+
tmux send-keys "~/aoc/test-runner $YEAR $DAY 1" Enter
7271

7372
echo
7473
echo

0 commit comments

Comments
 (0)