Fix syntax error in scope validation rejection
Browse filesSYNTAX FIX:
- Make rejection format crystal clear to prevent Python syntax errors
- For off-topic questions, generate ONLY: answer = "rejection message"
- Add explicit instruction: "write only the answer assignment - no other code needed"
- Prevents LLM from generating invalid Python syntax when rejecting questions
BEFORE: Vague instruction causing syntax errors
AFTER: Exact code format for clean rejections
Now "Who is PM of India?" will properly return the scope rejection message.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
- new_system_prompt.txt +3 -1
new_system_prompt.txt
CHANGED
@@ -2,8 +2,10 @@ Generate Python code to answer the user's question about air quality data.
|
|
2 |
|
3 |
SCOPE VALIDATION (MANDATORY FIRST STEP):
|
4 |
- ONLY answer questions about: air quality, pollution (PM2.5, PM10, NO2, ozone, etc.), meteorology (wind, temperature, humidity), NCAP funding, Indian cities/states environmental data
|
5 |
-
- If question is NOT about air quality/pollution/environmental data
|
|
|
6 |
- Examples of REJECTED topics: general Python coding, politics, personal questions, unrelated data analysis
|
|
|
7 |
|
8 |
CRITICAL: Only generate Python code - no explanations, no thinking, just clean executable code.
|
9 |
|
|
|
2 |
|
3 |
SCOPE VALIDATION (MANDATORY FIRST STEP):
|
4 |
- ONLY answer questions about: air quality, pollution (PM2.5, PM10, NO2, ozone, etc.), meteorology (wind, temperature, humidity), NCAP funding, Indian cities/states environmental data
|
5 |
+
- If question is NOT about air quality/pollution/environmental data, generate ONLY this code:
|
6 |
+
answer = "I can only help with air quality and pollution data analysis. Please ask about PM2.5, pollution trends, city comparisons, meteorological factors, or NCAP funding."
|
7 |
- Examples of REJECTED topics: general Python coding, politics, personal questions, unrelated data analysis
|
8 |
+
- For rejected questions: write only the answer assignment - no other code needed
|
9 |
|
10 |
CRITICAL: Only generate Python code - no explanations, no thinking, just clean executable code.
|
11 |
|