-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompts.py
32 lines (28 loc) · 2.15 KB
/
prompts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
thinking_to_code_prompt = """Here is my step-by-step thinking for solving a problem:
{explanation}
Here is the boilerplate code for the problem:
{stub}
Please follow only my thinking and convert it to code. Only follow my thinking. Please write just the code and nothing else."""
compare_code_prompt = """The first code snippet is the solution, the second code snippet is derived from the user's explanation.
{code1}
--------------------------------------------------
{code2}
--------------------------------------------------
The following is the user's pseudocode explanation:
{pseudocode}
Compare the following two code snippets and write "Yes" if the user's pseudocode explanation is sufficient and both code snippets cover the same edge cases, are both algorithmically correct, and that the second code snippet is at least as fast as the first code snippet. Write "No" if not.
Here is the LeetCode problem which both snippets of code are solving:
{problem}"""
hint_prompt = """The first code snippet is the solution, the second code snippet is derived from the user's explanation.
{code1}
--------------------------------------------------
{code2}
There is something missing from the second code snippet, either logically in that it fails to produce the same output, or that it is too slow with a large time complexity that can be optimized. Give a short hint on what is missing to the user so that they can reiterate. DO NOT write any Python code for the user and DO NOT reference anything about "code snippets," but give a verbal hint to lead the user in the right direction. Talk to the user directly, who verbally provided the pseudocode that generated the second code snippet, but limit your hint to at MOST one sentence.
Here is the pseudocode that the user provided:
{pseudocode}
Here is the LeetCode problem which both snippets of code are solving:
{problem}"""
refine_prompt = """This is the transcription of a voice recording:
{transcription}
Please refine the words appropriately and return that only. For context, the voice recording was about describing an approach to a coding problem."""
prompts = [thinking_to_code_prompt, compare_code_prompt, hint_prompt, refine_prompt]