Skip to content

Strategies for text to sql query generation, validation and execution

Notifications You must be signed in to change notification settings

ankur106/LLM-Text-to-SQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLM-Text-to-SQL

Here are the different approaches used to solve the problem

  1. SQl chain
  • Here llm is used to create sql query first and then through python pipe/chain the query is passed to sql database tool and finally llm sumarizes whatever outcome of the query.

  • We are passing SQL schema by default and the result can be optimized via passing example queries.

  • Or event we can send most relevant k queries in context via similarity search.

  1. SQL Agent
  • Langchain agentic approach can be more robust as it can regerate query and execute it if there is an execution error.

for example here it solved the error via adding state first when state was not available in state table SQL Agent

  1. If infrastructure is on aws reference
  • similar thing can be done on aws with glue(ETL) for metadata extraction, opensearch for similarity search, Bedrock and Athena for query execution. SQL Agent

About

Strategies for text to sql query generation, validation and execution

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages