Spaces:
Running
Running
re-order prompt modules to increase cache hit rate
Browse files
src/agents/prompts/query_analysis.py
CHANGED
|
@@ -48,13 +48,14 @@ DATABASE KNOWLEDGE (live from the vector store)
|
|
| 48 |
βββββββββββββββββββββββββββββββββββββββ
|
| 49 |
UI FILTERS (set by user in the sidebar)
|
| 50 |
βββββββββββββββββββββββββββββββββββββββ
|
| 51 |
-
|
| 52 |
UI filters always take priority. If they are set, use them and do NOT override from the query text.
|
| 53 |
|
| 54 |
βββββββββββββββββββββββββββββββββββββββ
|
| 55 |
PREVIOUS TURN FILTERS (from the last exchange in this conversation)
|
| 56 |
βββββββββββββββββββββββββββββββββββββββ
|
| 57 |
-
|
|
|
|
| 58 |
|
| 59 |
βββββββββββββββββββββββββββββββββββββββ
|
| 60 |
CONVERSATION CONTINUITY RULES
|
|
@@ -311,13 +312,19 @@ OUTPUT FORMAT (JSON only, no other text)
|
|
| 311 |
"needs_metadata_lookup": false
|
| 312 |
}}"""
|
| 313 |
|
| 314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
|
| 316 |
Conversation Context:
|
| 317 |
{conversation_context}
|
| 318 |
|
| 319 |
-
Previous turn filters: {prev_filter_desc}
|
| 320 |
-
|
| 321 |
Analyze and return JSON:"""
|
| 322 |
|
| 323 |
return ChatPromptTemplate.from_messages([
|
|
|
|
| 48 |
βββββββββββββββββββββββββββββββββββββββ
|
| 49 |
UI FILTERS (set by user in the sidebar)
|
| 50 |
βββββββββββββββββββββββββββββββββββββββ
|
| 51 |
+
The current UI filter values are provided in the user message below under "UI FILTERS:".
|
| 52 |
UI filters always take priority. If they are set, use them and do NOT override from the query text.
|
| 53 |
|
| 54 |
βββββββββββββββββββββββββββββββββββββββ
|
| 55 |
PREVIOUS TURN FILTERS (from the last exchange in this conversation)
|
| 56 |
βββββββββββββββββββββββββββββββββββββββ
|
| 57 |
+
The previous-turn filter snapshot is provided in the user message below under "PREVIOUS TURN FILTERS:".
|
| 58 |
+
Use these for carry-forward / replace / expand decisions per the rules below.
|
| 59 |
|
| 60 |
βββββββββββββββββββββββββββββββββββββββ
|
| 61 |
CONVERSATION CONTINUITY RULES
|
|
|
|
| 312 |
"needs_metadata_lookup": false
|
| 313 |
}}"""
|
| 314 |
|
| 315 |
+
_ui_filters_block = ui_filters if ui_filters else "None active β the user has not set any sidebar filters."
|
| 316 |
+
|
| 317 |
+
user_content = f"""UI FILTERS:
|
| 318 |
+
{_ui_filters_block}
|
| 319 |
+
|
| 320 |
+
PREVIOUS TURN FILTERS:
|
| 321 |
+
{prev_filter_desc}
|
| 322 |
+
|
| 323 |
+
Query: {query}
|
| 324 |
|
| 325 |
Conversation Context:
|
| 326 |
{conversation_context}
|
| 327 |
|
|
|
|
|
|
|
| 328 |
Analyze and return JSON:"""
|
| 329 |
|
| 330 |
return ChatPromptTemplate.from_messages([
|