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: wren-ai-service/src/pipelines/generation/intent_classification.py
+35-3Lines changed: 35 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,8 @@
24
24
25
25
intent_classification_system_prompt="""
26
26
### Task ###
27
-
You are an expert detective specializing in intent classification. Combine the user's current question and previous questions to determine their true intent based on the provided database schema. Classify the intent into one of these categories: `MISLEADING_QUERY`, `TEXT_TO_SQL`, `GENERAL`, or `USER_GUIDE`. Additionally, provide a concise reasoning (maximum 20 words) for your classification.
27
+
You are an expert detective specializing in intent classification. Combine the user's current question and previous questions to determine their true intent based on the provided database schema or sql data if provided.
28
+
Classify the intent into one of these categories: `MISLEADING_QUERY`, `TEXT_TO_SQL`, `DATA_EXPLORATION`, `GENERAL`, or `USER_GUIDE`. Additionally, provide a concise reasoning (maximum 20 words) for your classification.
28
29
29
30
### Instructions ###
30
31
- **Follow the user's previous questions:** If there are previous questions, try to understand the user's current question as following the previous questions.
@@ -39,6 +40,19 @@
39
40
40
41
### Intent Definitions ###
41
42
43
+
<DATA_EXPLORATION>
44
+
**When to Use:**
45
+
- The user's question is about data exploration such as asking for data details, asking for explanation of the data, asking for insights, asking for recommendations, asking for comparison, etc.
46
+
**Requirements:**
47
+
- SQL DATA is provided and the user's question is about exploring the data.
48
+
- The user's question can be answered by the SQL DATA.
49
+
- The row size of the SQL DATA is less than 500.
50
+
**Examples:**
51
+
- "Show me the part where the data appears abnormal"
52
+
- "Please explain the data in the table"
53
+
- "What's the trend of the data?"
54
+
</DATA_EXPLORATION>
55
+
42
56
<TEXT_TO_SQL>
43
57
**When to Use:**
44
58
- The user's inputs are about modifying SQL from previous questions.
@@ -51,6 +65,7 @@
51
65
- Must have complete filter criteria, specific values, or clear references to previous context.
52
66
- Include specific table and column names from the schema in your reasoning or modifying SQL from previous questions.
53
67
- Reference phrases from the user's inputs that clearly relate to the schema.
68
+
- The SQL DATA is not provided or SQL DATA cannot answer the user's question, and the user's question can be answered given the database schema.
54
69
55
70
**Examples:**
56
71
- "What is the total sales for last quarter?"
@@ -111,7 +126,7 @@
111
126
{
112
127
"rephrased_question": "<rephrased question in full standalone question if there are previous questions, otherwise the original question>",
0 commit comments