query_engine.update_prompts()
to update prompt but they use the high level query_engine = index.as_query_engine(response_mode="tree_summarize")
query_engine = SQLTableRetrieverQueryEngine( sql_database, obj_index.as_retriever(similarity_top_k=1), llm=function_llm, )
query_engine.update_prompts( {"response_synthesizer:summary_template": qa_prompt_tmpl} )
['response_synthesis_prompt', 'sql_retriever:text_to_sql_prompt']
"error": "'dialect'"
template = ( "We have provided context information below. \n" "---------------------\n" "{context_str}" "\n---------------------\n" "Given this information, please answer the question and each answer should start with code word AI Demos: {query_str}\n" )
"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. " "You can order the results by a relevant column to return the most " "interesting examples in the database.\n\n" "Never query for all the columns from a specific table, only ask for a " "few relevant columns given the question.\n\n" "Pay attention to use only the column names that you can see in the schema " "description. " "Be careful to not query for columns that do not exist. " "Pay attention to which column is in which table. " "Also, qualify column names with the table name when needed. " "You are required to use the following format, each taking one line:\n\n" "Question: Question here\n" "SQLQuery: SQL Query to run\n" "SQLResult: Result of the SQLQuery\n" "Answer: Final answer here\n\n" "Only use tables listed below.\n" "{schema}\n\n" "Question: {query_str}\n" "SQLQuery: "
query_engine3.update_prompts( {"response_synthesis_prompt": qa_prompt_tmpl}, # {"sql_retriever:text_to_sql_prompt": qa_template}, # {"response_synthesizer:text_qa_template": qa_template}, )
dialect
was part of it earlier in the default prompt or you added it from your side?dialect
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. 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 few relevant columns given the question." "ALWAYS FOLLOW THE GIVEN BELOW RULES." # My change added here! "Pay attention to use only the column names that you can see in the schema description. Be careful to not query for columns that do not exist. Pay attention to which column is in which table. Also, qualify column names with the table name when needed. You are required to use the following format, each taking one line:" "Question: Question here" "SQLQuery: SQL Query to run" "SQLResult: Result of the SQLQuery" "Answer: Final answer here" "Only use tables listed below." "{schema}" "Question: {query_str}" "SQLQuery: ")