mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-07 12:00:46 +00:00
feat: add schema-linking awel example (#1081)
This commit is contained in:
60
dbgpt/rag/schemalinker/base_linker.py
Normal file
60
dbgpt/rag/schemalinker/base_linker.py
Normal file
@@ -0,0 +1,60 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List
|
||||
|
||||
|
||||
class BaseSchemaLinker(ABC):
|
||||
"""Base Linker."""
|
||||
|
||||
def schema_linking(self, query: str) -> List:
|
||||
"""
|
||||
Args:
|
||||
query (str): query text
|
||||
Returns:
|
||||
List: list of schema
|
||||
"""
|
||||
return self._schema_linking(query)
|
||||
|
||||
def schema_linking_with_vector_db(self, query: str) -> List:
|
||||
"""
|
||||
Args:
|
||||
query (str): query text
|
||||
Returns:
|
||||
List: list of schema
|
||||
"""
|
||||
return self._schema_linking_with_vector_db(query)
|
||||
|
||||
async def schema_linking_with_llm(self, query: str) -> List:
|
||||
""" "
|
||||
Args:
|
||||
query(str): query text
|
||||
Returns:
|
||||
List: list of schema
|
||||
"""
|
||||
return await self._schema_linking_with_llm(query)
|
||||
|
||||
@abstractmethod
|
||||
def _schema_linking(self, query: str) -> List:
|
||||
"""
|
||||
Args:
|
||||
query (str): query text
|
||||
Returns:
|
||||
List: list of schema
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def _schema_linking_with_vector_db(self, query: str) -> List:
|
||||
"""
|
||||
Args:
|
||||
query (str): query text
|
||||
Returns:
|
||||
List: list of schema
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def _schema_linking_with_llm(self, query: str) -> List:
|
||||
"""
|
||||
Args:
|
||||
query (str): query text
|
||||
Returns:
|
||||
List: list of schema
|
||||
"""
|
Reference in New Issue
Block a user