dolphinium commited on
Commit
43c6bd6
·
1 Parent(s): 78e7277

pup: date aware summary reporter

Browse files
Files changed (1) hide show
  1. llm_prompts.py +10 -5
llm_prompts.py CHANGED
@@ -240,6 +240,7 @@ def get_synthesis_report_prompt(query, quantitative_data, qualitative_data, plan
240
  """
241
  qualitative_prompt_str = ""
242
  dimension = plan.get('analysis_dimension', 'N/A')
 
243
  if qualitative_data and dimension in qualitative_data:
244
  for group in qualitative_data.get(dimension, {}).get('groups', []):
245
  group_value = group.get('groupValue', 'N/A')
@@ -263,15 +264,19 @@ You are a top-tier business intelligence analyst. Your task is to write an insig
263
  ### AVAILABLE INFORMATION
264
 
265
  **1. The User's Core Question:**
266
- \"{query}\"
267
 
268
- **2. Quantitative Data (The 'What'):**
269
- This data shows the high-level aggregates.
 
 
 
 
270
  ```json
271
  {json.dumps(quantitative_data, indent=2)}
272
  ```
273
 
274
- **3. Qualitative Data (The 'Why'):**
275
  These are the single most significant documents driving the numbers for each category.
276
  {qualitative_prompt_str}
277
 
@@ -283,7 +288,7 @@ Your report must be in clean, professional Markdown and follow this structure pr
283
  **Report Structure:**
284
 
285
  `## Executive Summary`
286
- - A 1-2 sentence, top-line answer to the user's question based on the quantitative data.
287
 
288
  `### Key Findings`
289
  - Use bullet points to highlight the main figures from the quantitative data. Interpret the numbers.
 
240
  """
241
  qualitative_prompt_str = ""
242
  dimension = plan.get('analysis_dimension', 'N/A')
243
+ query_filter = plan.get('query_filter', 'Not available') # Extract query filter from the plan
244
  if qualitative_data and dimension in qualitative_data:
245
  for group in qualitative_data.get(dimension, {}).get('groups', []):
246
  group_value = group.get('groupValue', 'N/A')
 
264
  ### AVAILABLE INFORMATION
265
 
266
  **1. The User's Core Question:**
267
+ "{query}"
268
 
269
+ **2. Data Filters Applied:**
270
+ This is the exact Solr query filter that was used to retrieve the underlying data. Use this to understand the precise scope of the analysis (e.g., the time range or specific categories).
271
+ `{query_filter}`
272
+
273
+ **3. Quantitative Data (The 'What'):**
274
+ This data shows the high-level aggregates based on the filters above.
275
  ```json
276
  {json.dumps(quantitative_data, indent=2)}
277
  ```
278
 
279
+ **4. Qualitative Data (The 'Why'):**
280
  These are the single most significant documents driving the numbers for each category.
281
  {qualitative_prompt_str}
282
 
 
288
  **Report Structure:**
289
 
290
  `## Executive Summary`
291
+ - A 1-2 sentence, top-line answer to the user's question. **Crucially, use the 'Data Filters Applied' information to state the context of your answer** (e.g., "Over the past month...", "For deals in the cancer category...", "In 2024...").
292
 
293
  `### Key Findings`
294
  - Use bullet points to highlight the main figures from the quantitative data. Interpret the numbers.