acadiaway commited on
Commit
3d893a8
·
1 Parent(s): b276f15

Fix SyntaxError in pipeline.py by completing f-string prompt

Browse files
Files changed (1) hide show
  1. pipeline.py +16 -0
pipeline.py CHANGED
@@ -27,3 +27,19 @@ def text_to_sql(nl_query):
27
  init_model()
28
  schema = get_schema()
29
  prompt = f"""### Task
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  init_model()
28
  schema = get_schema()
29
  prompt = f"""### Task
30
+ Generate a SQL query to answer the following natural language question: {nl_query}
31
+
32
+ ### Database Schema
33
+ {schema}
34
+
35
+ ### Response Format
36
+ Output only the SQL query.
37
+ """
38
+ sampling_params = SamplingParams(temperature=0, max_tokens=512)
39
+ outputs = model.generate([prompt], sampling_params)
40
+ sql = outputs[0].outputs[0].text.strip()
41
+ results = execute_sql(sql)
42
+ return sql, results
43
+ except Exception as e:
44
+ print(f"Error in text_to_sql: {e}")
45
+ raise