mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-10-23 01:49:58 +00:00
feat(rag): Support RAG SDK (#1322)
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
"""Datasource operator for RDBMS database."""
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, List
|
||||
|
||||
from dbgpt.core.interface.operators.retriever import RetrieverOperator
|
||||
from dbgpt.datasource.rdbms.base import RDBMSConnector
|
||||
from dbgpt.datasource.base import BaseConnector
|
||||
from dbgpt.rag.summary.rdbms_db_summary import _parse_db_summary
|
||||
|
||||
|
||||
class DatasourceRetrieverOperator(RetrieverOperator[Any, Any]):
|
||||
class DatasourceRetrieverOperator(RetrieverOperator[Any, List[str]]):
|
||||
"""The Datasource Retriever Operator."""
|
||||
|
||||
def __init__(self, connection: RDBMSConnector, **kwargs):
|
||||
def __init__(self, connector: BaseConnector, **kwargs):
|
||||
"""Create a new DatasourceRetrieverOperator."""
|
||||
super().__init__(**kwargs)
|
||||
self._connection = connection
|
||||
self._connector = connector
|
||||
|
||||
def retrieve(self, input_value: Any) -> Any:
|
||||
def retrieve(self, input_value: Any) -> List[str]:
|
||||
"""Retrieve the database summary."""
|
||||
summary = _parse_db_summary(self._connection)
|
||||
summary = _parse_db_summary(self._connector)
|
||||
return summary
|
||||
|
Reference in New Issue
Block a user