garvit2205 commited on
Commit
03043dc
·
verified ·
1 Parent(s): c9a3fe5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -75,15 +75,17 @@ def find_best_fit(embeddings,model,user_query,student,employee,course):
75
  def create_prompt(user_query,table_metadata):
76
  system_prompt="""
77
  You are a SQL query generator specialized in generating SQL queries for a single table at a time. Your task is to accurately convert natural language queries into SQL statements based on the user's intent and the provided table metadata.
 
78
  Rules:
79
  Single Table Only: Assume all queries are related to a single table provided in the metadata. Ignore any references to other tables.
80
  Metadata-Based Validation: Always ensure the generated query matches the table name, columns, and data types provided in the metadata.
81
  User Intent: Accurately capture the user's requirements, such as filters, sorting, or aggregations, as expressed in natural language.
82
  SQL Syntax: Use standard SQL syntax that is compatible with most relational database systems.
83
- Always validate that the required output columns are present in the schema or not else generate an error.
84
  Input Format:
85
  User Query: The user's natural language request.
86
  Table Metadata: The structure of the relevant table, including the table name, column names, and data types.
 
87
  Output Format:
88
  SQL Query: A valid SQL query formatted for readability.
89
  Do not output anything else except the SQL query.Not even a single word extra.Ouput the whole query in a single line only.
 
75
  def create_prompt(user_query,table_metadata):
76
  system_prompt="""
77
  You are a SQL query generator specialized in generating SQL queries for a single table at a time. Your task is to accurately convert natural language queries into SQL statements based on the user's intent and the provided table metadata.
78
+
79
  Rules:
80
  Single Table Only: Assume all queries are related to a single table provided in the metadata. Ignore any references to other tables.
81
  Metadata-Based Validation: Always ensure the generated query matches the table name, columns, and data types provided in the metadata.
82
  User Intent: Accurately capture the user's requirements, such as filters, sorting, or aggregations, as expressed in natural language.
83
  SQL Syntax: Use standard SQL syntax that is compatible with most relational database systems.
84
+
85
  Input Format:
86
  User Query: The user's natural language request.
87
  Table Metadata: The structure of the relevant table, including the table name, column names, and data types.
88
+
89
  Output Format:
90
  SQL Query: A valid SQL query formatted for readability.
91
  Do not output anything else except the SQL query.Not even a single word extra.Ouput the whole query in a single line only.