Update app.py
Browse files
app.py
CHANGED
@@ -282,9 +282,8 @@ def rephrase_query(chat_history, query, temperature=0.2):
|
|
282 |
- First, check if the query contains words indicating current information (e.g., "today", "now", "current", "latest"):
|
283 |
- If present, do NOT add any date operators to the query
|
284 |
- Otherwise, if the query mentions a specific time period (e.g., a quarter, year, or date range):
|
285 |
-
- Add appropriate "after:"
|
286 |
-
- Use the format "after:YYYY
|
287 |
-
- For quarters, use the start and end dates of the following quarter (when results would typically be reported).
|
288 |
- If no specific time period is mentioned and no current-time indicators are present:
|
289 |
- Append "after: {CURRENT_YEAR}" to the end of the rephrased query.
|
290 |
- Ensure there is a space before "after:" and "before:" for proper formatting.
|
@@ -312,10 +311,6 @@ def rephrase_query(chat_history, query, temperature=0.2):
|
|
312 |
**Scenario 4: Current Status Query**
|
313 |
- **User Query**: "What is the current market share of Toyota and Honda in the US?"
|
314 |
- **Rephrased Query**: "What is the current market share of \"Toyota\" and \"Honda\" in the \"US\""
|
315 |
-
|
316 |
-
**Scenario 5: Query Without Recognizable Entities but with Time Period**
|
317 |
-
- **User Query**: "What were the major scientific breakthroughs in 2024?"
|
318 |
-
- **Rephrased Query**: "What were the major scientific breakthroughs in 2024 after:2024-01-01 before:2024-12-31"
|
319 |
"""
|
320 |
|
321 |
# Create the user prompt with the chat history and current query
|
|
|
282 |
- First, check if the query contains words indicating current information (e.g., "today", "now", "current", "latest"):
|
283 |
- If present, do NOT add any date operators to the query
|
284 |
- Otherwise, if the query mentions a specific time period (e.g., a quarter, year, or date range):
|
285 |
+
- Add appropriate "after:" operators to the end of the rephrased query.
|
286 |
+
- Use the format "after:YYYY" for date ranges.
|
|
|
287 |
- If no specific time period is mentioned and no current-time indicators are present:
|
288 |
- Append "after: {CURRENT_YEAR}" to the end of the rephrased query.
|
289 |
- Ensure there is a space before "after:" and "before:" for proper formatting.
|
|
|
311 |
**Scenario 4: Current Status Query**
|
312 |
- **User Query**: "What is the current market share of Toyota and Honda in the US?"
|
313 |
- **Rephrased Query**: "What is the current market share of \"Toyota\" and \"Honda\" in the \"US\""
|
|
|
|
|
|
|
|
|
314 |
"""
|
315 |
|
316 |
# Create the user prompt with the chat history and current query
|