Update app/prompts.py
Browse files- app/prompts.py +24 -34
app/prompts.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
"""
|
| 2 |
prompts.py — All LangChain ChatPromptTemplates in one place.
|
| 3 |
-
Import from here; never hardcode prompts elsewhere.
|
| 4 |
"""
|
| 5 |
from langchain_core.prompts import ChatPromptTemplate
|
| 6 |
|
|
@@ -9,65 +8,56 @@ from langchain_core.prompts import ChatPromptTemplate
|
|
| 9 |
PANEL_PROMPT = ChatPromptTemplate.from_messages([
|
| 10 |
(
|
| 11 |
"system",
|
| 12 |
-
"""You are an expert software debugger
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
- Provide a CORRECTED solution with working code examples
|
| 18 |
-
- If multiple issues exist, list all of them
|
| 19 |
-
- Be concise, precise, and professional
|
| 20 |
|
| 21 |
-
|
| 22 |
-
),
|
| 23 |
-
(
|
| 24 |
-
"human",
|
| 25 |
-
"{question}",
|
| 26 |
),
|
|
|
|
| 27 |
])
|
| 28 |
|
| 29 |
|
| 30 |
-
# ── Judge:
|
| 31 |
JUDGE_PROMPT = ChatPromptTemplate.from_messages([
|
| 32 |
(
|
| 33 |
"system",
|
| 34 |
-
"""You are a
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
Your
|
| 37 |
-
1.
|
| 38 |
-
2.
|
| 39 |
-
3.
|
| 40 |
|
| 41 |
-
|
| 42 |
|
| 43 |
-
##
|
| 44 |
-
[
|
| 45 |
|
| 46 |
-
## ✅
|
| 47 |
-
[The
|
| 48 |
),
|
| 49 |
(
|
| 50 |
"human",
|
| 51 |
-
"""
|
| 52 |
{question}
|
| 53 |
|
| 54 |
---
|
| 55 |
|
| 56 |
-
###
|
| 57 |
{response_1}
|
| 58 |
|
| 59 |
---
|
| 60 |
|
| 61 |
-
###
|
| 62 |
{response_2}
|
| 63 |
|
| 64 |
---
|
| 65 |
|
| 66 |
-
|
| 67 |
-
{response_3}
|
| 68 |
-
|
| 69 |
-
---
|
| 70 |
-
|
| 71 |
-
Now analyze all three responses and provide your reasoning and the definitive final answer.""",
|
| 72 |
),
|
| 73 |
-
])
|
|
|
|
| 1 |
"""
|
| 2 |
prompts.py — All LangChain ChatPromptTemplates in one place.
|
|
|
|
| 3 |
"""
|
| 4 |
from langchain_core.prompts import ChatPromptTemplate
|
| 5 |
|
|
|
|
| 8 |
PANEL_PROMPT = ChatPromptTemplate.from_messages([
|
| 9 |
(
|
| 10 |
"system",
|
| 11 |
+
"""You are an expert software debugger.
|
| 12 |
|
| 13 |
+
Analyze the user's code or question and:
|
| 14 |
+
1. Identify the exact bug or error and its root cause
|
| 15 |
+
2. Provide the fully corrected working code
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
Be precise and concise. Use fenced code blocks (```language) for all code.""",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
),
|
| 19 |
+
("human", "{question}"),
|
| 20 |
])
|
| 21 |
|
| 22 |
|
| 23 |
+
# ── Judge: Structured Debugging Output ────────────────────────────────────────
|
| 24 |
JUDGE_PROMPT = ChatPromptTemplate.from_messages([
|
| 25 |
(
|
| 26 |
"system",
|
| 27 |
+
"""You are a senior software engineer and code reviewer acting as a judge.
|
| 28 |
+
|
| 29 |
+
You will receive a debugging question and two AI responses.
|
| 30 |
|
| 31 |
+
Your task:
|
| 32 |
+
1. Identify the TRUE root cause of the bug from both responses
|
| 33 |
+
2. Produce ONE perfectly corrected, complete, runnable piece of code
|
| 34 |
+
3. Write a clear, short error explanation
|
| 35 |
|
| 36 |
+
You MUST respond using EXACTLY these section headers (no deviations):
|
| 37 |
|
| 38 |
+
## 🐛 Error Analysis
|
| 39 |
+
[2-5 sentences: what the bug is, why it happens, what line/logic is wrong]
|
| 40 |
|
| 41 |
+
## ✅ Corrected Code
|
| 42 |
+
[The complete corrected code in a single fenced code block — nothing else in this section]""",
|
| 43 |
),
|
| 44 |
(
|
| 45 |
"human",
|
| 46 |
+
"""DEBUGGING QUESTION:
|
| 47 |
{question}
|
| 48 |
|
| 49 |
---
|
| 50 |
|
| 51 |
+
### Debugger 1 — {label_1}
|
| 52 |
{response_1}
|
| 53 |
|
| 54 |
---
|
| 55 |
|
| 56 |
+
### Debugger 2 — {label_2}
|
| 57 |
{response_2}
|
| 58 |
|
| 59 |
---
|
| 60 |
|
| 61 |
+
Now produce the Error Analysis and the Corrected Code.""",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
),
|
| 63 |
+
])
|