Manoj Kumar
commited on
Commit
·
f753320
1
Parent(s):
92a290e
updated question structure
Browse files- gpt_neo_db.py +13 -11
gpt_neo_db.py
CHANGED
|
@@ -48,14 +48,16 @@ def generate_sql_query(context, question):
|
|
| 48 |
# Schema as a context for the model
|
| 49 |
schema_description = json.dumps(db_schema, indent=4)
|
| 50 |
|
| 51 |
-
# Example interactive questions
|
| 52 |
-
print("Ask a question about the database schema.")
|
| 53 |
-
while True:
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
| 48 |
# Schema as a context for the model
|
| 49 |
schema_description = json.dumps(db_schema, indent=4)
|
| 50 |
|
| 51 |
+
# # Example interactive questions
|
| 52 |
+
# print("Ask a question about the database schema.")
|
| 53 |
+
# while True:
|
| 54 |
+
# user_question = input("Question: ")
|
| 55 |
+
# if user_question.lower() in ["exit", "quit"]:
|
| 56 |
+
# print("Exiting...")
|
| 57 |
+
# break
|
| 58 |
+
|
| 59 |
+
user_question = 'Show all products that cost more than $50'
|
| 60 |
+
|
| 61 |
+
# Generate SQL query
|
| 62 |
+
sql_query = generate_sql_query(schema_description, user_question)
|
| 63 |
+
print(f"Generated SQL Query:\n{sql_query}\n")
|