Skip to content
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

SQL error: execute() first #7

Open
potong opened this issue Jul 17, 2023 · 5 comments
Open

SQL error: execute() first #7

potong opened this issue Jul 17, 2023 · 5 comments

Comments

@potong
Copy link

potong commented Jul 17, 2023

image

@Prem95
Copy link

Prem95 commented Jul 17, 2023 via email

@potong
Copy link
Author

potong commented Jul 18, 2023

It means your database is not connected

On Mon, 17 Jul 2023 at 6:14 PM, TianMin @.> wrote: [image: image] https://user-images.githubusercontent.com/10555409/253911188-a4906d0c-5071-45ee-869a-07c46d3c2f86.png — Reply to this email directly, view it on GitHub <#7>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDKTMVPCQ47PC7XG3GYHQTXQUF6VANCNFSM6AAAAAA2MW4OJY . You are receiving this because you are subscribed to this thread.Message ID: @.>

I see the problem here:
image

Change the pattern to:
pattern = r"Step(\d+):\s+(.?)\n(.)\n"

@tom68-ll
Copy link

tom68-ll commented Aug 31, 2023

Hello, author. We followed the advice and modified the pattern of the regular expression. However, this caused all the answers to the questions to include the phrase "not need memory". We suspect that there might still be an issue with the pattern here. @potong

@ATX735
Copy link

ATX735 commented Sep 3, 2023

I try to ask the question "What was the total revenue for January 2023?", The LLM generates the following middle-stage answer:

` ` `
Step1: Calculate the total revenue for January 2023
SELECT SUM(total_price) AS total_revenue
FROM sales
WHERE sale_date >= '2023-01-01' AND sale_date <= '2023-01-31';
` ` `

Notice that, the SQL is not surrounded by backtick `. Therefore, causing the regular expression pattern pattern = r"Step(\d+):\s+(.*?)\n(.*?)" fail to match the SQL, which induces this error.
According to the prompt in this program, the LLM's output should look like the text that is shown below with the SQL surrounded by backtick `:

` ` `
Step1: Calculate the total revenue for January 2023
`SELECT SUM(total_price) AS total_revenue
FROM sales
WHERE sale_date >= '2023-01-01' AND sale_date <= '2023-01-31';`
` ` `

@ZhengChen6
Copy link

image

image
Just add "`" like this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants