Update SQLDatabaseChain.py to use the specific chain class for SQLDatabase
This commit is contained in:
parent
f9aba724b9
commit
db7eef597b
1 changed files with 2 additions and 7 deletions
|
|
@ -1,15 +1,12 @@
|
||||||
|
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from langchain.chains import Chain
|
|
||||||
from typing import Callable, Union
|
from typing import Callable, Union
|
||||||
from langflow.field_typing import (
|
from langflow.field_typing import (
|
||||||
BasePromptTemplate,
|
BasePromptTemplate,
|
||||||
BaseLanguageModel,
|
BaseLanguageModel,
|
||||||
|
Chain
|
||||||
)
|
)
|
||||||
|
from langchain_community.utilities.sql_database import SQLDatabase
|
||||||
# Placeholder SQLDatabase class. In practice, replace this with the actual class or import it if available.
|
|
||||||
class SQLDatabase:
|
|
||||||
pass
|
|
||||||
|
|
||||||
class SQLDatabaseChainComponent(CustomComponent):
|
class SQLDatabaseChainComponent(CustomComponent):
|
||||||
display_name = "SQLDatabaseChain"
|
display_name = "SQLDatabaseChain"
|
||||||
|
|
@ -28,6 +25,4 @@ class SQLDatabaseChainComponent(CustomComponent):
|
||||||
llm: BaseLanguageModel,
|
llm: BaseLanguageModel,
|
||||||
prompt: BasePromptTemplate,
|
prompt: BasePromptTemplate,
|
||||||
) -> Union[Chain, Callable]:
|
) -> 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)
|
return Chain(db=db, llm=llm, prompt=prompt)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue