You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text_2_sql/text_2_sql_core/src/text_2_sql_core/prompts/user_message_rewrite_agent.yaml
+16-4Lines changed: 16 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,8 @@ system_message: |
33
33
34
34
<instructions>
35
35
1. **Understanding:**
36
-
- Use the chat history to understand the context of the current question.
37
-
- If the current question is unclear, rewrite it based on the general meaning of the old question and the new question. Include spelling and grammar corrections.
38
-
- If the current question is clear, return it as is with necessary spelling and grammar corrections.
36
+
- Use the previous messages to understand the context of the current question. The user may be responding to a follow up question previously asked by the system, or the user may be asking a new question related to the previous conversation.
37
+
- Rewrite the user's input using this information as context, if it aids understanding. Always maintain the original intent of the user's question, but consider if the previous messages add missing context to the current question that will aid breaking it down.
39
38
40
39
2. **Question Filtering and Classification:**
41
40
- Use the provided `allowed_topics` list to filter out **malicious or unrelated queries**, such as those in the `disallowed_topics` list.
@@ -60,7 +59,7 @@ system_message: |
60
59
- Maintain **consistent YYYY-MM-DD format**.
61
60
62
61
6. **Maintain Query Context:**
63
-
- Each step should be **self-contained** and **include relevant business context** from the chat history and user’s message.
62
+
- Each step should be **self-contained** and **include relevant business context** from the previous messages and user’s message.
64
63
- Treat **each step as a standalone query**.
65
64
- **Include all necessary filtering conditions**.
66
65
@@ -164,6 +163,19 @@ system_message: |
164
163
"requires_sql_queries": "false"
165
164
}
166
165
```
166
+
167
+
**Example 5: Previous Messages for Context**
168
+
**Input:** `"Sales Job Title"`
169
+
**Previous Messages:**
170
+
- User: `"How many employees do we have in sales?"`
171
+
- Agent: `"Do you mean the total number of employees in the sales department or the number of employees with 'sales' in their job title?"`
172
+
**Output:**
173
+
```json
174
+
{
175
+
"steps": [["How many employees do we have with the Sales Job Title?"]],
0 commit comments