SQL Agent - Difference in sql_db_query_checker and sql_db_query #26768
Replies: 1 comment
-
The difference in the actual executed query ('$..' vs '$.[].') generated by To fix this issue, you can ensure that the query checker tool generates the desired query format by customizing the Here is how you can disable the query checker tool: db_chain = SQLDatabaseChain.from_llm(OpenAI(), db, use_query_checker=False) Or, if you need to customize the from langchain_core.prompts.prompt import PromptTemplate
custom_query_checker_prompt = PromptTemplate(
template="Your custom prompt template here",
input_variables=["query", "dialect"]
)
db_chain = SQLDatabaseChain.from_llm(
OpenAI(), db,
use_query_checker=True,
query_checker_prompt=custom_query_checker_prompt
) By adjusting these settings, you can control the format of the executed query [1]. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
{
"10": {
"quantity": "10",
.....
}
}
Invoking:
sql_db_query_checker
with `{'query': "SELECT JSON_UNQUOTE(JSON_EXTRACT(point_of_sales, '$.*.quantity')) AS quantity FROM stock WHERE store = 'STORE_NAME'Whereas below is the actual query gets executed resulted [(None,)]
Invoking:
sql_db_query
with `{'query': "SELECT JSON_UNQUOTE(JSON_EXTRACT(point_of_sales, '$.[*].quantity')) AS quantity FROM stock WHERE store = 'STORE_NAME'What is the reason actual executed query ('$..' vs '$.[].) generated differently? Please help to me fix.
System Info
langchain==0.2.16
windows
Python 3.11.0
Beta Was this translation helpful? Give feedback.
All reactions