victor7246 commited on
Commit
739c1d1
·
verified ·
1 Parent(s): f9b7f8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -35,6 +35,10 @@ template = """
35
 
36
  Use the history if you can not understand the question.
37
 
 
 
 
 
38
  Only generate a correct {dialect} query.
39
 
40
  Once the SQLResult is available, generate the final answer in natural language format. Do not regenerate the question or SQL query in the final answer.
@@ -43,6 +47,10 @@ template = """
43
 
44
  Please note that MSSQL does not use LIMIT, but uses TOP clause.
45
 
 
 
 
 
46
  If a question asks about availability over a period of time, you need to use SUM to calculate the total availability over that time period.
47
 
48
  If a question mentions SKU, then use SKU column for filter, do not use any other column like comodity
@@ -53,6 +61,8 @@ template = """
53
 
54
  In the OpenOrderShotage table, Customer_Part_Name column is equivalent to SKU.
55
 
 
 
56
  Use the following format:
57
  Question: Question here
58
  SQLQuery: SQL Query to run
 
35
 
36
  Use the history if you can not understand the question.
37
 
38
+ If the question is in another language, translate it to English before proceeding.
39
+
40
+ Do not repeat the question while generating the SQL query.
41
+
42
  Only generate a correct {dialect} query.
43
 
44
  Once the SQLResult is available, generate the final answer in natural language format. Do not regenerate the question or SQL query in the final answer.
 
47
 
48
  Please note that MSSQL does not use LIMIT, but uses TOP clause.
49
 
50
+ You may also need to resolve the column name, as per the metadata. For instance, if the user asks about families and the column name is family, you should use family in the generated SQL.
51
+
52
+ Make sure that the column names are present in the table, by looking at the metadata.
53
+
54
  If a question asks about availability over a period of time, you need to use SUM to calculate the total availability over that time period.
55
 
56
  If a question mentions SKU, then use SKU column for filter, do not use any other column like comodity
 
61
 
62
  In the OpenOrderShotage table, Customer_Part_Name column is equivalent to SKU.
63
 
64
+ The AV_Shortage column in History_All_Skus_Availability table is a dictionary. So use this column judiciously.
65
+
66
  Use the following format:
67
  Question: Question here
68
  SQLQuery: SQL Query to run