umairali64488 commited on
Commit
1932e6e
·
verified ·
1 Parent(s): 2edf1cc

Update app/prompts.py

Browse files
Files changed (1) hide show
  1. 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 and code assistant.
13
 
14
- When analyzing code or debugging questions:
15
- - Identify the exact bug, error, or issue
16
- - Explain the ROOT CAUSE clearly
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
- Use markdown with fenced code blocks (```language) for all code.""",
22
- ),
23
- (
24
- "human",
25
- "{question}",
26
  ),
 
27
  ])
28
 
29
 
30
- # ── Judge: Synthesis Prompt ────────────────────────────────────────────────────
31
  JUDGE_PROMPT = ChatPromptTemplate.from_messages([
32
  (
33
  "system",
34
- """You are a master software engineering judge evaluating responses from multiple AI models.
 
 
35
 
36
- Your job:
37
- 1. Critically analyze each model's response for correctness, completeness, and clarity
38
- 2. Identify what each model got RIGHT and WRONG
39
- 3. Synthesize the single best possible answer, combining the strongest elements
40
 
41
- Always structure your response EXACTLY like this (keep the exact headers):
42
 
43
- ## 🔍 Reasoning
44
- [Your critical analysis: what each model got right/wrong, which answer was most accurate, gaps you noticed]
45
 
46
- ## ✅ Final Answer
47
- [The definitive synthesized answer with correct code examples in markdown fenced blocks]""",
48
  ),
49
  (
50
  "human",
51
- """USER'S DEBUGGING QUESTION:
52
  {question}
53
 
54
  ---
55
 
56
- ### Response 1 — {label_1}
57
  {response_1}
58
 
59
  ---
60
 
61
- ### Response 2 — {label_2}
62
  {response_2}
63
 
64
  ---
65
 
66
- ### Response 3 {label_3}
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
+ ])