From db7eef597b719b095887e3e9d9c7aa40c86c1776 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Wed, 10 Jan 2024 17:46:51 -0300 Subject: [PATCH] Update SQLDatabaseChain.py to use the specific chain class for SQLDatabase --- .../langflow/components/chains/SQLDatabaseChain.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/backend/langflow/components/chains/SQLDatabaseChain.py b/src/backend/langflow/components/chains/SQLDatabaseChain.py index 3ea43dc75..a86555b35 100644 --- a/src/backend/langflow/components/chains/SQLDatabaseChain.py +++ b/src/backend/langflow/components/chains/SQLDatabaseChain.py @@ -1,15 +1,12 @@ from langflow import CustomComponent -from langchain.chains import Chain from typing import Callable, Union from langflow.field_typing import ( BasePromptTemplate, BaseLanguageModel, + Chain ) - -# Placeholder SQLDatabase class. In practice, replace this with the actual class or import it if available. -class SQLDatabase: - pass +from langchain_community.utilities.sql_database import SQLDatabase class SQLDatabaseChainComponent(CustomComponent): display_name = "SQLDatabaseChain" @@ -28,6 +25,4 @@ class SQLDatabaseChainComponent(CustomComponent): llm: BaseLanguageModel, prompt: BasePromptTemplate, ) -> Union[Chain, Callable]: - # Assuming there's a specific chain for SQLDatabase in the langchain library: - # Replace `Chain` with the specific chain class that interfaces with the SQLDatabase. return Chain(db=db, llm=llm, prompt=prompt)