Spaces:
Runtime error
Runtime error
Update agents/live/app/prompts.py
Browse files
agents/live/app/prompts.py
CHANGED
|
@@ -84,9 +84,9 @@ When casting a JSON string to numeric for division/math, ALWAYS wrap the extract
|
|
| 84 |
Correct: `(a.attributes::jsonb->'data'->>'timestamp')::numeric / 1000`
|
| 85 |
Wrong: `a.attributes::jsonb->'data'->>'timestamp'::numeric / 1000`
|
| 86 |
|
| 87 |
-
JSONB OPERATORS RULE (CRITICAL):
|
| 88 |
- ALWAYS use `->>` to navigate and extract a text field from JSONB: `ad.value::jsonb->>'Temperature'`.
|
| 89 |
- NEVER use subtraction `-` to extract fields. `-` is ONLY for deleting keys from JSONB. Doing `(ad.value::jsonb - 'Data' - 'temperature')::numeric` WILL FAIL with a database error!
|
|
|
|
| 90 |
- JSON keys are case-sensitive. ColdRooms use capitalized keys: `Temperature` and `Humidity`.
|
| 91 |
|
| 92 |
Available context:
|
|
@@ -113,5 +113,6 @@ Requirements:
|
|
| 113 |
- FORMATTING: For a single asset, use clean, bolded bullet points. For multiple assets (reports/comparisons), use a Markdown table as instructed in the system message.
|
| 114 |
- TIME CRITICAL: Always convert long technical timestamps (e.g., '2026-04-03 15:43:11.398') into short, human-friendly times (e.g., '3:43 PM, Apr 3').
|
| 115 |
- TANK LEVEL CRITICAL: Rows for tank queries will include pre-computed columns: `current_level_ft` (actual liquid level), `percentage_filled` (fill %), and `max_ft` (max capacity). Present these directly. DO NOT perform any arithmetic on tank data. If `current_level_ft` is 0 or null, say the tank is empty.
|
|
|
|
| 116 |
- End with one helpful next suggestion when appropriate and when the system message requires it.
|
| 117 |
""".strip()
|
|
|
|
| 84 |
Correct: `(a.attributes::jsonb->'data'->>'timestamp')::numeric / 1000`
|
| 85 |
Wrong: `a.attributes::jsonb->'data'->>'timestamp'::numeric / 1000`
|
| 86 |
|
|
|
|
| 87 |
- ALWAYS use `->>` to navigate and extract a text field from JSONB: `ad.value::jsonb->>'Temperature'`.
|
| 88 |
- NEVER use subtraction `-` to extract fields. `-` is ONLY for deleting keys from JSONB. Doing `(ad.value::jsonb - 'Data' - 'temperature')::numeric` WILL FAIL with a database error!
|
| 89 |
+
- To get the timestamp of a reading, use `ad.timestamp` (which is a native TIMESTAMP column in the `asset_datapoint` table). NEVER try to extract a timestamp from `ad.value` or use subtraction `-` to get a numeric timestamp.
|
| 90 |
- JSON keys are case-sensitive. ColdRooms use capitalized keys: `Temperature` and `Humidity`.
|
| 91 |
|
| 92 |
Available context:
|
|
|
|
| 113 |
- FORMATTING: For a single asset, use clean, bolded bullet points. For multiple assets (reports/comparisons), use a Markdown table as instructed in the system message.
|
| 114 |
- TIME CRITICAL: Always convert long technical timestamps (e.g., '2026-04-03 15:43:11.398') into short, human-friendly times (e.g., '3:43 PM, Apr 3').
|
| 115 |
- TANK LEVEL CRITICAL: Rows for tank queries will include pre-computed columns: `current_level_ft` (actual liquid level), `percentage_filled` (fill %), and `max_ft` (max capacity). Present these directly. DO NOT perform any arithmetic on tank data. If `current_level_ft` is 0 or null, say the tank is empty.
|
| 116 |
+
- ONLINE STATUS: When reporting online devices, include a 'Status' column in the table indicating that each device is '**Online**' and display only its latest sensor reading and timestamp.
|
| 117 |
- End with one helpful next suggestion when appropriate and when the system message requires it.
|
| 118 |
""".strip()
|