The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Don't instruct LLM to use the LIMIT clause, which is incompatible with SQL Server (#1242)
Jon Luo8a3581155655
diff --git a/langchain/chains/sql_database/prompt.py b/langchain/chains/sql_database/prompt.pyindex 127579e2c0..8b0fd1529e 100644--- a/langchain/chains/sql_database/prompt.py+++ b/langchain/chains/sql_database/prompt.py@@ -2,7 +2,7 @@from langchain.prompts.base import CommaSeparatedListOutputParserfrom langchain.prompts.prompt import PromptTemplate-_DEFAULT_TEMPLATE = """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. Unless the user specifies in his question a specific number of examples he wishes to obtain, always limit your query to at most {top_k} results using the LIMIT clause. You can order the results by a relevant column to return the most interesting examples in the database.+_DEFAULT_TEMPLATE = """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. Unless the user specifies in his question a specific number of examples he wishes to obtain, always limit your query to at most {top_k} results. You can order the results by a relevant column to return the most interesting examples in the database.Never query for all the columns from a specific table, only ask for a the few relevant columns given the question.