-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
remove quotes from sql database prompts (caused syntax error) #4101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems reasonable to me!
I agree. This PR is a good solution to the problem. IMO removing the quotes (just in case the LLM decides to generate them for some reason) would also be helpful. So I think #3385 is also a valid change that should be made. |
Doesn't fix the problem for me Comparing the test run of the current master, and the current master + this PR applied, there is no difference, and the extraneous quotes appear for the same queries (test DB + test case Python script attached; https://github.com/rdancer/langchain.git@f873b94 is the current master + this PR applied) |
If you insert the following snippet in your fragment it starts working. It should have the same effect as removing the quotes from the prompt file, strange...:
|
IMO the solution for this problem should be two measures:
|
@rdancer Now I did, and on my machine your example runs without error. Could you verify if the changes in the prompt-file (removing of the quotes) were actually applied when you tested the PR? |
fixes a syntax error mentioned in
#2027 and #3305
another PR to remedy is in #3385, but I believe that is not tacking the core problem.
Also #2027 mentions a solution that works:
add to the prompt:
'The SQL query should be outputted plainly, do not surround it in quotes or anything else.'
To me it seems strange to first ask for:
SQLQuery: "SQL Query to run"
and then to tell the LLM not to put the quotes around it. Other templates (than the sql one) do not use quotes in their steps.
This PR changes that to:
SQLQuery: SQL Query to run