-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQLDatabaseChain returning Question and SQL Query instead of answer #13994
Comments
🤖 Hello @NivedhaBalakrishnan, Welcome to the LangChain repository! I'm Dosu, a bot designed to assist with bugs, questions, and contributions while you're waiting for a human maintainer. I'm here to help you with your issue, so please feel free to ask me anything. Let's get started, shall we? Based on the information you've provided, it seems like the The Here is the relevant code from the def run(self, input_: str) -> str:
"""
Runs the chain on the given input.
"""
self._reset()
self._input = input_
self._run()
return self._output The However, without access to the exact implementation of the Also, it's worth noting that the I hope this helps! If you have any more questions or need further clarification, feel free to ask. Best regards, Sources |
FYI, I see that it's a consistent behavior in all SQL chains (no surprise):
|
Is there a way to resolve this>? |
System Info
Code
db_chain = SQLDatabaseChain.from_llm(llm, db, verbose=True, return_sql=False, use_query_checker=True, prompt=prompt_template)
db_chain.run("What are some recently added dockets and their title?")
Verbose
Output:
'SELECT id, title, modifyDate FROM docket ORDER BY modifyDate DESC LIMIT 5;'
The chain is not returning the SQLResult in the chat format even though the query is executed correctly.
Who can help?
No response
Information
Related Components
Reproduction
prompt_suffix = """
If asked for recent dockets, give 5 most recent ones.
Make sure the table name is in the database.
Table name: docket,
Use only these columns when selecting: id, title, modifyDate
"""
prompt_template = PromptTemplate.from_template(prompt_suffix)
db_chain = SQLDatabaseChain.from_llm(llm, db, verbose=True, return_sql=False, use_query_checker=True, prompt=prompt_template)
db_chain.run("What are some recently added dockets and their title?")
Expected behavior
Example output:
The recently added dockets with their dates are:\n\n* CMS-2023-0181 - CY 2024 Inpatient Hospital Deductible and Hospital and Extended Care Services Coinsurance Amounts (November 1st, 2023'
The text was updated successfully, but these errors were encountered: