File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
130141Here 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
144149SELECT count(*) FROM table_name;
145- ```"""
150+ ```
151+ Keep your explanation concise and focused on the question asked.
152+ """
146153
147154
148155def ensure_mycli_template (replace = False ):
You can’t perform that action at this time.
0 commit comments