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
You are a data analyst great at visualizing data using vega-lite! Given the user's request, SQL, sample data, sample column values, original vega-lite schema,
27
+
you need to re-generate vega-lite schema in JSON and provide suitable chart type.
28
+
Besides, you need to give a concise and easy-to-understand reasoning to describe why you provide such vega-lite schema based on the question, SQL, sample data, sample column values, original vega-lite schema and adjustment options.
29
+
30
+
{chart_generation_instructions}
31
+
- If you think the user's request are not suitable for the data or not suitable for generating the chart, you can return an empty string for the schema and chart type and give reasoning to explain why.
32
+
33
+
### OUTPUT FORMAT ###
34
+
35
+
Please provide your chain of thought reasoning, chart type and the vega-lite schema in JSON format.
Copy file name to clipboardExpand all lines: wren-ai-service/src/pipelines/generation/intent_classification.py
+6-51
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,7 @@
23
23
24
24
intent_classification_system_prompt="""
25
25
### Task ###
26
-
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.
27
-
Classify the intent into one of these categories: `MISLEADING_QUERY`, `TEXT_TO_SQL`, `DATA_EXPLORATION`, `GENERAL`, `CHART`, or `USER_GUIDE`. Additionally, provide a concise reasoning (maximum 20 words) for your classification.
26
+
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.
28
27
29
28
### Instructions ###
30
29
- **Follow the user's previous questions:** If there are previous questions, try to understand the user's current question as following the previous questions.
@@ -36,20 +35,6 @@
36
35
37
36
### Intent Definitions ###
38
37
39
-
<DATA_EXPLORATION>
40
-
**When to Use:**
41
-
- 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.
42
-
43
-
**Requirements:**
44
-
- SQL DATA is provided and the user's question is about exploring the data.
45
-
- The user's question can be answered by the SQL DATA.
46
-
47
-
**Examples:**
48
-
- "Show me the part where the data appears abnormal"
49
-
- "Please explain the data in the table"
50
-
- "What's the trend of the data?"
51
-
</DATA_EXPLORATION>
52
-
53
38
<TEXT_TO_SQL>
54
39
**When to Use:**
55
40
- The user's inputs are about modifying SQL from previous questions.
@@ -59,27 +44,13 @@
59
44
**Requirements:**
60
45
- Include specific table and column names from the schema in your reasoning or modifying SQL from previous questions.
61
46
- Reference phrases from the user's inputs that clearly relate to the schema.
62
-
- 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.
63
47
64
48
**Examples:**
65
49
- "What is the total sales for last quarter?"
66
50
- "Show me all customers who purchased product X."
67
51
- "List the top 10 products by revenue."
68
52
</TEXT_TO_SQL>
69
53
70
-
<CHART>
71
-
**When to Use:**
72
-
- The user's question is about generating a chart.
73
-
74
-
**Requirements:**
75
-
- The user's question can be answered by the SQL DATA.
76
-
- SQL DATA is provided.
77
-
- Should pick a SQL from user query histories and the picked SQL should be reflected to the SQL DATA provided.
78
-
79
-
**Examples:**
80
-
- "Show me the bar chart of the data"
81
-
</CHART>
82
-
83
54
<GENERAL>
84
55
**When to Use:**
85
56
- The user seeks general information about the database schema or its overall capabilities.
@@ -112,11 +83,9 @@
112
83
- The user's inputs is irrelevant to the database schema or includes SQL code.
113
84
- The user's inputs lacks specific details (like table names or columns) needed to generate an SQL query.
114
85
- It appears off-topic or is simply a casual conversation starter.
115
-
- The user's question is about generating a chart but the SQL DATA is not provided.
116
86
117
87
**Requirements:**
118
-
- For generating SQL: respond to users by incorporating phrases from the user's inputs that indicate the lack of relevance to the database schema.
119
-
- For generating chart: respond to users that we can generate chart only if there is some data available.
88
+
- Incorporate phrases from the user's inputs that indicate the lack of relevance to the database schema.
120
89
121
90
**Examples:**
122
91
- "How are you?"
@@ -130,8 +99,7 @@
130
99
{
131
100
"rephrased_question": "<rephrased question in full standalone question if there are previous questions, otherwise the original question>",
0 commit comments