richardr1126
commited on
Commit
•
b7ec18f
1
Parent(s):
a6cb97b
New prompt
Browse files
app.py
CHANGED
@@ -130,15 +130,15 @@ def extract_db_code(text):
|
|
130 |
return [match.strip() for match in matches]
|
131 |
|
132 |
def generate_dummy_db(db_info, question):
|
133 |
-
pre_prompt = "Generate a SQLite database with dummy data for this database from the DB Layout
|
134 |
prompt = pre_prompt + "\n\nDB Layout:" + db_info + "\n\nQuestion: " + question
|
135 |
|
136 |
while True:
|
137 |
try:
|
138 |
response = openai.ChatCompletion.create(
|
139 |
-
model="gpt-
|
140 |
messages=[
|
141 |
-
{"role": "system", "content": "You are a SQLite dummy database generator.\
|
142 |
{"role": "user", "content": prompt}
|
143 |
],
|
144 |
#temperature=0.7,
|
@@ -152,8 +152,8 @@ def generate_dummy_db(db_info, question):
|
|
152 |
|
153 |
except Exception as e:
|
154 |
print(f'Error occurred: {str(e)}')
|
155 |
-
print('Waiting for
|
156 |
-
time.sleep(
|
157 |
|
158 |
def test_query_on_dummy_db(db_code, query):
|
159 |
try:
|
|
|
130 |
return [match.strip() for match in matches]
|
131 |
|
132 |
def generate_dummy_db(db_info, question):
|
133 |
+
pre_prompt = "Generate a SQLite database with dummy data for this database from the DB Layout."
|
134 |
prompt = pre_prompt + "\n\nDB Layout:" + db_info + "\n\nQuestion: " + question
|
135 |
|
136 |
while True:
|
137 |
try:
|
138 |
response = openai.ChatCompletion.create(
|
139 |
+
model="gpt-3.5-turbo",
|
140 |
messages=[
|
141 |
+
{"role": "system", "content": "You are a SQLite dummy database generator.\n1. You will create the specified dummy database.\n2. Use the same exact table and column names used from the DB Layout.\n3. Insert dummy data relevant to the Question.\n4. Output the only the datbase code in a code block."},
|
142 |
{"role": "user", "content": prompt}
|
143 |
],
|
144 |
#temperature=0.7,
|
|
|
152 |
|
153 |
except Exception as e:
|
154 |
print(f'Error occurred: {str(e)}')
|
155 |
+
print('Waiting for 10 seconds before retrying...')
|
156 |
+
time.sleep(10)
|
157 |
|
158 |
def test_query_on_dummy_db(db_code, query):
|
159 |
try:
|