Fix system prompt to generate appropriate text vs plot responses
Browse files- Add clear guidance on when to create plots vs text answers
- Questions with 'Which', 'What', asking for specific values β TEXT ANSWERS
- Questions with 'Plot', 'Show', 'Visualize' β PLOTS
- Simple direct questions should get text answers, not plots
- This should fix the issue of getting plots for questions that need direct answers
π€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
src.py
CHANGED
@@ -289,14 +289,17 @@ df["Timestamp"] = pd.to_datetime(df["Timestamp"])
|
|
289 |
|
290 |
IMPORTANT: Only generate Python code - no explanations, no thinking, just clean code.
|
291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
Requirements:
|
293 |
- Save final result in variable called 'answer'
|
294 |
-
- For
|
295 |
-
- For
|
296 |
-
- Use proper syntax: f"filename_{{uuid.uuid4().hex[:8]}}.png"
|
297 |
-
- Add plt.tight_layout() before saving plots
|
298 |
- Convert numpy types to int when using as indices: int(value)
|
299 |
-
- Use simple plt.legend() without complex arguments
|
300 |
- Always use .iloc or .loc properly for pandas indexing
|
301 |
"""
|
302 |
|
|
|
289 |
|
290 |
IMPORTANT: Only generate Python code - no explanations, no thinking, just clean code.
|
291 |
|
292 |
+
WHEN TO CREATE PLOTS vs TEXT ANSWERS:
|
293 |
+
- Questions asking "Which", "What", specific values β TEXT ANSWERS (store text in 'answer')
|
294 |
+
- Questions asking "Plot", "Show", "Visualize", "Chart" β PLOTS (store filename in 'answer')
|
295 |
+
- Questions asking for comparisons of many items β PLOTS
|
296 |
+
- Simple direct questions β TEXT ANSWERS
|
297 |
+
|
298 |
Requirements:
|
299 |
- Save final result in variable called 'answer'
|
300 |
+
- For TEXT: Store the direct answer as a string in 'answer'
|
301 |
+
- For PLOTS: Save with unique filename f"plot_{{uuid.uuid4().hex[:8]}}.png" and store filename in 'answer'
|
|
|
|
|
302 |
- Convert numpy types to int when using as indices: int(value)
|
|
|
303 |
- Always use .iloc or .loc properly for pandas indexing
|
304 |
"""
|
305 |
|