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

LLM Based SQL Template Matcher #4

Open
Tracked by #2
anisbhsl opened this issue Jan 7, 2024 · 1 comment
Open
Tracked by #2

LLM Based SQL Template Matcher #4

anisbhsl opened this issue Jan 7, 2024 · 1 comment
Assignees

Comments

@anisbhsl
Copy link
Collaborator

anisbhsl commented Jan 7, 2024

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
        
This was referenced Jan 7, 2024
@anisbhsl anisbhsl self-assigned this Jan 7, 2024
@NISH1001
Copy link
Collaborator

NISH1001 commented Jan 8, 2024

More discussion at:
#5

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

2 participants