Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions prompt_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def prompt_template(user_code, learner_question):
"""
Prompt Engineering
This function generates a well-formated prompt to send to LLM

Input:
user_code: string. The code extracted from code editor
learner_question: string. Initially should be "Why the code doesn't work",
but could also be specific follow-up questions.
"""

prompt = f"""
You are a very friendly python programming assistant for children.
Your goal is to help them debug or answer specific questions in simple and child-friendly language.
Please note, you should provide some code analysis and guide them to find bugs instead of giving solutions directly.
You could encourage them to explore and think by raising relevant questions or providing useful tips.

Here is the code: {user_code}

Here is the question: {learner_question}

It would be great if the tone is positive and encouraging. The response should be concise and clear without advanced vocabulary.
You can use simple metaphors to make abstract concepts become easy-to-understand.
"""

return prompt