Package com.hw.langchain.chains.base
Class Chain
java.lang.Object
com.hw.langchain.chains.base.Chain
- Direct Known Subclasses:
AgentExecutor
,ApiChain
,BaseCombineDocumentsChain
,BaseRetrievalQA
,LLMChain
,LLMMathChain
,SQLDatabaseChain
,SQLDatabaseSequentialChain
Base interface that all chains should implement.
- Author:
- HamaWhite
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasyncInnerCall
(Map<String, Object> inputs) Runs the logic of this chain and returns the async output.reactor.core.publisher.Flux<String>
Run the chain as text in, text out asyncreactor.core.publisher.Flux<String>
Run the chain as multiple variables, text out async.Run the logic of this chain and add to output if desired.Run the logic of this chain and add to output if desired.abstract String
Runs the logic of this chain and returns the output.Retrieves the list of input keys that this chain expects.Retrieves the list of output keys that this chain expects.prepInputs
(Map<String, Object> inputs) Validate and prep inputs.Run the chain as text in, text outRun the chain as multiple variables, text out.
-
Field Details
-
memory
-
-
Constructor Details
-
Chain
public Chain()
-
-
Method Details
-
chainType
-
inputKeys
Retrieves the list of input keys that this chain expects.- Returns:
- the list of input keys
-
outputKeys
Retrieves the list of output keys that this chain expects.- Returns:
- the list of output keys
-
innerCall
Runs the logic of this chain and returns the output.- Parameters:
inputs
- the inputs to be processed by the chain- Returns:
- a map containing the output generated by the chain
-
asyncInnerCall
Runs the logic of this chain and returns the async output.- Parameters:
inputs
- the inputs to be processed by the chain- Returns:
- a map flux containing the output generated event by the chain
-
call
Run the logic of this chain and add to output if desired.- Parameters:
input
- single input if chain expects only one param.returnOnlyOutputs
- boolean for whether to return only outputs in the response. If True, only new keys generated by this chain will be returned. If False, both input keys and new keys generated by this chain will be returned. Defaults to False.
-
call
Run the logic of this chain and add to output if desired.- Parameters:
inputs
- Dictionary of inputs.returnOnlyOutputs
- boolean for whether to return only outputs in the response. If True, only new keys generated by this chain will be returned. If False, both input keys and new keys generated by this chain will be returned. Defaults to False.
-
asyncCall
-
asyncCall
-
prepInputs
Validate and prep inputs. -
run
Run the chain as text in, text out -
run
Run the chain as multiple variables, text out. -
asyncRun
Run the chain as text in, text out async -
asyncRun
Run the chain as multiple variables, text out async.
-