Skip to content

Commit eeba007

Browse files
committed
Update the prompt.
1 parent 4ff9c25 commit eeba007

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

mycli/packages/special/llm.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,26 +123,33 @@ def __init__(self, results=None):
123123
# https://llm.datasette.io/en/stable/plugins/directory.html
124124
"""
125125
_SQL_CODE_FENCE = r"```sql\n(.*?)\n```"
126-
PROMPT = """A MySQL database has the following schema:
126+
PROMPT = """
127+
You are a helpful assistant who is a MySQL expert. You are embedded in a mysql
128+
cli tool called mycli.
129+
130+
Answer this question:
131+
132+
$question
133+
134+
Use the following context if it is relevant to answering the question. If the
135+
question is not about the current database then ignore the context.
136+
137+
You are connected to a MySQL database with the following schema:
127138
128139
$db_schema
129140
130141
Here is a sample row of data from each table:
131142
132143
$sample_data
133144
134-
Use the provided schema and the sample data to construct a SQL query that
135-
can be run in MySQL to answer
136-
137-
$question
138-
139-
Explain the reason for choosing each table in the SQL query you have
140-
written. Keep the explanation concise.
141-
Finally include a sql query in a code fence such as this one:
145+
If the answer can be found using a SQL query, include a sql query in a code
146+
fence such as this one:
142147
143148
```sql
144149
SELECT count(*) FROM table_name;
145-
```"""
150+
```
151+
Keep your explanation concise and focused on the question asked.
152+
"""
146153

147154

148155
def ensure_mycli_template(replace=False):

0 commit comments

Comments
 (0)