Replies: 1 comment
-
Answer generated by a 🤖 AnswerI understand that you're using the SQLDatabaseChain with a standard template and you're manually formatting the prompt before running the chain. You're wondering if this step is necessary and how the prompt is formed if you don't manually format it. You've also noticed that changing the structure of the prompt causes errors and you're curious about why this happens. Let me clarify this for you. When you're using the The errors you're seeing when you change the structure of the prompt are likely because both the Here's how you can run the chain without manually formatting the prompt: sql_prompt = PromptTemplate(input_variables=["input", "table_info", "dialect"], template=sql_agent_prompt_template)
db_chain = SQLDatabaseChain.from_llm(llm, db, prompt=sql_prompt, verbose=True)
db_chain.run(input="<question>", table_info="<table>", dialect="sqlite") In this example, the This is one potential solution based on my understanding of your issue. If you find this answer helpful and believe it's not covered by the existing documentation, I encourage you to make a pull request to update the documentation. This could be beneficial for other users who might encounter the same issue. SourcesThis response is meant to be useful, save you time, and share context. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently using a SQLDatabaseChain with the standard template from the documentation:
In the docs and other threads I've seen online, it doesn't look like running the chain requires you to specify the input variables when running, but I have been running it in this way:
This works, but is harder to scale. Is it not necessary to include the
sql_prompt.format()
in the run command?And if not, how is it forming an accurate prompt? I notice when I change the structure of the prompt, the chain errors - is this because this specific template is structured to succeed on the chain?
Thank you for helping me understand better!
Beta Was this translation helpful? Give feedback.
All reactions