Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,16 @@ def ask_question(user_db, question):
|
|
| 39 |
cursor = conn.cursor()
|
| 40 |
|
| 41 |
# Create a Text-to-SQL prompt
|
| 42 |
-
prompt = f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
# ✅ Use .invoke() instead of calling the object directly
|
| 45 |
response = sqlcoder_llm.invoke(prompt)
|
|
|
|
| 39 |
cursor = conn.cursor()
|
| 40 |
|
| 41 |
# Create a Text-to-SQL prompt
|
| 42 |
+
prompt = f"""
|
| 43 |
+
You are an expert SQL generator.
|
| 44 |
+
The database follows the Chinook schema with tables:
|
| 45 |
+
customers, invoices, invoice_items, tracks, albums, artists, employees, genres, media_types, playlists, playlist_track.
|
| 46 |
+
Translate this question into a valid SQLite query for this schema.
|
| 47 |
+
Return only SQL (no text).
|
| 48 |
+
Question: {question}
|
| 49 |
+
SQL:
|
| 50 |
+
"""
|
| 51 |
+
|
| 52 |
|
| 53 |
# ✅ Use .invoke() instead of calling the object directly
|
| 54 |
response = sqlcoder_llm.invoke(prompt)
|