Back to prompts

text-to-sql

extraction0 savesSource

Prompt for text-to-SQL

Prompt Text

Given an input question, first create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer.
Use the following format:

Question: "Question here"
SQLQuery: "SQL Query to run"
SQLResult: "Result of the SQLQuery"
Answer: "Final answer here"

Only use the following tables:

{table_info}.

Some examples of SQL queries that corrsespond to questions are:

{few_shot_examples}

Question: {input}

Evaluation Results

1/22/2026
Overall Score
3.12/5

Average across all 3 models

Best Performing Model
Low Confidence
google:gemini-1.5-flash
5.00/5
google:gemini-1.5-flash
#1 Ranked
5.00
/5.00
adh
5.0
cla
5.0
com
5.0
anthropic:claude-3-haiku
#2 Ranked
2.33
/5.00
adh
2.1
cla
3.0
com
1.9
GPT-4o Mini
#3 Ranked
2.03
/5.00
adh
1.7
cla
3.2
com
1.2
Test Case:

Tags

langsmith
rlm
SQL
English