Description
Implement a LLMBasedSQLTemplateMatcher class that takes in a user query text and provides top_k matching templates by substituting the entities.
class LLMBasedSQLTemplateMatcher(SQLTemplateMatcher):
"""
LLMBasedSQLTemplateMatcher uses LLM to find the best matching template.
Given a query, it will extract the key entities and use LLM to find best SQL template
and generates a subsituted SQL query.
Args:
templates: A list of SQL templates.
ddl_schema: The DDL schema for available tables.
similarity_threshold: The similarity threshold to be used for fuzzy matching.
"""
def __init__(self, templates: List[SQLTemplate],
ddl_schema: Optional[str] = None,
similarity_threshold: float = 0.4,
debug: bool = False) -> None:
super().__init__(debug = debug)
self.templates = templates
self.ddl_schema = ddl_schema
self.similarity_threshold = similarity_threshold
def match(self, query: str, top_k = 1, **kwargs) -> List[str]:
pass
Description
Implement a
LLMBasedSQLTemplateMatcherclass that takes in a user query text and providestop_kmatching templates by substituting the entities.