Skip to content

SQLDatabaseChain from experimental langchain cannot collect SQL query from model output (Syntax error) #28788

Answered by feijoes
GameModes asked this question in Q&A
Discussion options

You must be logged in to vote

I’ve never used SQLDatabaseChain before and didn’t notice anything unusual in the template or the provided code. You might want to try using the default prompt to see if it generates any errors. However, here are my recommendations:

1 Create a custom SQLDatabaseChain where it generates the query and executes it. You can try extracting the SQL from the string using something like:
.replace('"', "").replace("sql", "")

2 Consider using create_sql_agent. I think you can achieve the same result, and it’s easier to set up.

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@GameModes
Comment options

@feijoes
Comment options

Answer selected by GameModes
@GameModes
Comment options

@feijoes
Comment options

@GameModes
Comment options

@feijoes
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants