Update main.py
Browse files
main.py
CHANGED
|
@@ -12,24 +12,6 @@ app = FastAPI()
|
|
| 12 |
|
| 13 |
@app.post("/generate_sql")
|
| 14 |
async def generate_sql(item: Validation):
|
| 15 |
-
# Updated system prompt
|
| 16 |
-
system_prompt = """### Task
|
| 17 |
-
Generate a SQL query to answer the following question:
|
| 18 |
-
`{question}`
|
| 19 |
-
|
| 20 |
-
### Database Schema
|
| 21 |
-
The query will run on a database with the following schema:
|
| 22 |
-
{schema}
|
| 23 |
-
|
| 24 |
-
###Instructions
|
| 25 |
-
-Understand the question and the database schema provided
|
| 26 |
-
-based on the given question and the database schema,generate a proper SQL
|
| 27 |
-
|
| 28 |
-
### Answer
|
| 29 |
-
Given the database schema, here is the SQL query that answers `{question}`:
|
| 30 |
-
```sql
|
| 31 |
-
"""
|
| 32 |
# Format the actual prompt using item.prompt
|
| 33 |
-
|
| 34 |
-
completion = llm(prompt)
|
| 35 |
return completion
|
|
|
|
| 12 |
|
| 13 |
@app.post("/generate_sql")
|
| 14 |
async def generate_sql(item: Validation):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
# Format the actual prompt using item.prompt
|
| 16 |
+
completion = llm(item.prompt)
|
|
|
|
| 17 |
return completion
|