-
Notifications
You must be signed in to change notification settings - Fork 977
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
[Bug] Double quotation around SQL query issue in 06-langchain-agents.ipynb #180
Comments
Yep. I'm running into this too. But even after updating the description suggested above, I'm getting the following error:
|
James left a comment in the video:
https://www.youtube.com/watch?v=jSP-gSEyVeI&t=172s |
Thanks for the fix @janzheng. Had this issue on my mac terminal. Doing this as you said in your initial issue fixed it for me. sql_tool = Tool( ... ,description="Useful for when you need to answer questions about stocks and their prices. The SQL query should be outputted plainly, do not surround it in quotes or anything else.") Seems strange the description has anything to do with the output. Seems more like a command to an LLM. |
OK I see how the description works is explained in the next step. print(zero_shot_agent.agent.llm_chain.prompt.template) |
The quotes command helped for the first example, but then on the next example failed with an issue. Using the prepending like this worked for both.
|
I still get similar syntax errors despite using different variations like:
For instance this:
At first seems to create a nice query:
But one line later messes it up again: Which gives the OperationalError. Any thought are very much appreciated :) |
Is this a new bug?
Current Behavior
When replicating in a Python notebook, the SQL Database tool produces this error, because of the double quotation marks ("")
OperationalError: near ""SELECT stock_ticker, price, date FROM stocks WHERE (stock_ticker = 'ABC' OR stock_ticker = 'XYZ') AND (date = '2023-01-03' OR date = '2023-01-04') LIMIT 5"": syntax error
Expected Behavior
Single quotation marks:
"SELECT stock_ticker, price, date FROM stocks WHERE (stock_ticker = 'ABC' OR stock_ticker = 'XYZ') AND (date = '2023-01-03' OR date = '2023-01-04') LIMIT 5"
This can be done by changing the description to:
Steps To Reproduce
Run with colab
Relevant log output
No response
Environment
Additional Context
Adding the extra description seems to prevent double quotes
The text was updated successfully, but these errors were encountered: