prompt = f"""-- language: SQL
### Question: {query}
### Input: {create_sql}
### Response:
Here is the SQL query I have generated to 
answer the question `{query}`:
```sql
"""

Prompt写法很重要

  1. 说明语言类型,– language: SQL
  2. 将SQL建表语句放到SQL prompt中,因为大语言是通过SQL建表语句进行识别的
  3. SQL编写用 ```sql,放到prompt最后安全sql补全代码 (Prompt中的首尾很重要)