Spaces:
Sleeping
Sleeping
Update chat.py
Browse files
chat.py
CHANGED
@@ -91,7 +91,7 @@ class ChatHandler:
|
|
91 |
template_query_generation = """
|
92 |
|
93 |
Based on the table schema below, write a mySQL query with correct syntax that would answer the user's question.
|
94 |
-
Only write the SQL query without explanations.
|
95 |
|
96 |
Schema:
|
97 |
{schema}
|
@@ -154,9 +154,9 @@ class ChatHandler:
|
|
154 |
{
|
155 |
"name": "Database Schema",
|
156 |
"function": lambda q: self._load_schema_from_database(q),
|
157 |
-
"description": """Search within the mysql database schema and generate SQL-based responses.
|
158 |
The database has single table 'tp_material_forecast' which contains the columns 'date', 'material_name', 'material_quantity', and 'type'. Frame the query only with these four columns.
|
159 |
-
If the material name is given,
|
160 |
If the material name is not present in the table, return the proper message as "This material name is not in the database". Do not give any false values if the material name is not available in database.
|
161 |
display the response as a combination of response summary and the response data in the form of table. If the response has month column, display the month as name For example, January instead of displaying as 1.
|
162 |
If the user requested comparison between two or more years or the user asks for the data for all years, data should be shown for all the years with month as first column and the years like 2020, 2021 etc as the adjacent columns.
|
|
|
91 |
template_query_generation = """
|
92 |
|
93 |
Based on the table schema below, write a mySQL query with correct syntax that would answer the user's question.
|
94 |
+
Only write the SQL query without explanations and without string 'sql'and '''.
|
95 |
|
96 |
Schema:
|
97 |
{schema}
|
|
|
154 |
{
|
155 |
"name": "Database Schema",
|
156 |
"function": lambda q: self._load_schema_from_database(q),
|
157 |
+
"description": """Search within the mysql database schema and generate SQL-based responses.
|
158 |
The database has single table 'tp_material_forecast' which contains the columns 'date', 'material_name', 'material_quantity', and 'type'. Frame the query only with these four columns.
|
159 |
+
If the material name is given, frame the query in such a way that the material_name is not case-sensitive.
|
160 |
If the material name is not present in the table, return the proper message as "This material name is not in the database". Do not give any false values if the material name is not available in database.
|
161 |
display the response as a combination of response summary and the response data in the form of table. If the response has month column, display the month as name For example, January instead of displaying as 1.
|
162 |
If the user requested comparison between two or more years or the user asks for the data for all years, data should be shown for all the years with month as first column and the years like 2020, 2021 etc as the adjacent columns.
|