Description
Current implementation uses SQL agent to generate SQL statement when provided with user query. This is inconsistent and it is difficult to railguard the response. To prevent this, create a SQLTemplateMatcher as base class which will have following base classes
FuzzySQLTemplateMatcher : Rule based query to SQL statement
LLMBasedSQLTemplateMatcher : LLM based query to SQL template matcher with entity extraction
Refer to this boilerplate for base class:
class SQLTemplateMatcher:
def __init__(self, ...):
...
def add_query_template(self, query, sql_statement):
...
def match(self, query) -> list:
return top k matched sql statements along with entity substition (or we can do subsition in another step)
The constructor could take: table schema, sql templates
Deliverables
### Tasks
- [ ] https://github.com/NASA-IMPACT/larch/issues/3
- [ ] https://github.com/NASA-IMPACT/larch/issues/4
Description
Current implementation uses SQL agent to generate SQL statement when provided with user query. This is inconsistent and it is difficult to railguard the response. To prevent this, create a
SQLTemplateMatcheras base class which will have following base classesFuzzySQLTemplateMatcher: Rule based query to SQL statementLLMBasedSQLTemplateMatcher: LLM based query to SQL template matcher with entity extractionRefer to this boilerplate for base class:
The constructor could take: table schema, sql templates
Deliverables