From 6e25e650859fc86365252e0bdf8fd2223e5dec1c Mon Sep 17 00:00:00 2001 From: Will Smith Date: Sun, 4 Jun 2023 22:39:00 +0100 Subject: [PATCH] SQL agent : Improved prompt engineering prevents agent guessing database column names. (#5671) @vowelparrot: Minor change to the SQL agent: Tells agent to introspect the schema of the most relevant tables, I found this to dramatically decrease the chance that the agent wastes times guessing column names. --- langchain/agents/agent_toolkits/sql/prompt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/agents/agent_toolkits/sql/prompt.py b/langchain/agents/agent_toolkits/sql/prompt.py index 2891fbbc..2a8ced66 100644 --- a/langchain/agents/agent_toolkits/sql/prompt.py +++ b/langchain/agents/agent_toolkits/sql/prompt.py @@ -17,5 +17,5 @@ If the question does not seem related to the database, just return "I don't know SQL_SUFFIX = """Begin! Question: {input} -Thought: I should look at the tables in the database to see what I can query. +Thought: I should look at the tables in the database to see what I can query. Then I should query the schema of the most relevant tables. {agent_scratchpad}"""