Class SQLDatabaseSequentialChain
java.lang.Object
com.hw.langchain.chains.base.Chain
com.hw.langchain.chains.sql.database.base.SQLDatabaseSequentialChain
Chain for querying SQL database that is a sequential chain.
The chain is as follows: 1. Based on the query, determine which tables to use. 2. Based on those tables, call the normal SQL database chain. This is useful in cases where the number of tables in the database is large.
- Author:
- HamaWhite
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSQLDatabaseSequentialChain
(SQLDatabaseChain sqlChain, LLMChain deciderChain) -
Method Summary
Modifier and TypeMethodDescriptionstatic SQLDatabaseSequentialChain
fromLLM
(BaseLanguageModel llm, SQLDatabase database) static SQLDatabaseSequentialChain
fromLLM
(BaseLanguageModel llm, SQLDatabase database, BasePromptTemplate queryPrompt, BasePromptTemplate deciderPrompt) Load the necessary chains.Runs the logic of this chain and returns the output.Return the singular input key.Return the singular output key.
-
Constructor Details
-
SQLDatabaseSequentialChain
-
-
Method Details
-
fromLLM
public static SQLDatabaseSequentialChain fromLLM(BaseLanguageModel llm, SQLDatabase database, BasePromptTemplate queryPrompt, BasePromptTemplate deciderPrompt) Load the necessary chains. -
fromLLM
-
chainType
-
inputKeys
Return the singular input key. -
outputKeys
Return the singular output key.- Specified by:
outputKeys
in classChain
- Returns:
- the list of output keys
-
innerCall
Description copied from class:Chain
Runs the logic of this chain and returns the output.
-