adamboom111 commited on
Commit
18824a6
·
verified ·
1 Parent(s): 9b2d1b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -15,7 +15,7 @@ Instructions:
15
  - Use only the table and columns listed in the metadata.
16
  - Never generate queries with columns not present in the metadata.
17
  - If a column like 'gender' is not present, do not mention it.
18
- - Do not hallucinate values. Use provided structure only.
19
  - Output valid SQL (DuckDB-compatible), single line, no comments or explanations.
20
 
21
  Input:
@@ -25,8 +25,7 @@ Table Metadata:
25
 
26
  Output:
27
  A single valid SQL SELECT statement using only metadata-provided columns.
28
- """
29
-
30
  return system_prompt.strip(), f"User Query: {user_query}\nTable Metadata: {table_metadata}"
31
 
32
  def generate_output(system_prompt, user_prompt):
@@ -41,7 +40,6 @@ def generate_output(system_prompt, user_prompt):
41
  response = chat_completion.choices[0].message.content.strip()
42
  return response if response.lower().startswith("select") else "Can't perform the task at the moment."
43
 
44
- # NEW: accepts user_query and dynamic table_metadata string
45
  def response(payload):
46
  user_query = payload.get("question", "")
47
  table_metadata = payload.get("schema", "")
 
15
  - Use only the table and columns listed in the metadata.
16
  - Never generate queries with columns not present in the metadata.
17
  - If a column like 'gender' is not present, do not mention it.
18
+ - Do not hallucinate values or table names. Use provided structure only.
19
  - Output valid SQL (DuckDB-compatible), single line, no comments or explanations.
20
 
21
  Input:
 
25
 
26
  Output:
27
  A single valid SQL SELECT statement using only metadata-provided columns.
28
+ """
 
29
  return system_prompt.strip(), f"User Query: {user_query}\nTable Metadata: {table_metadata}"
30
 
31
  def generate_output(system_prompt, user_prompt):
 
40
  response = chat_completion.choices[0].message.content.strip()
41
  return response if response.lower().startswith("select") else "Can't perform the task at the moment."
42
 
 
43
  def response(payload):
44
  user_query = payload.get("question", "")
45
  table_metadata = payload.get("schema", "")