Package com.hw.langchain.chains.api.base
Class ApiChain
java.lang.Object
com.hw.langchain.chains.base.Chain
com.hw.langchain.chains.api.base.ApiChain
Chain that makes API calls and summarizes the responses to answer a question.
- Author:
- HamaWhite
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionApiChain(LLMChain apiRequestChain, LLMChain apiAnswerChain, TextRequestsWrapper requestsWrapper, String apiDocs) -
Method Summary
Modifier and TypeMethodDescriptionstatic ApiChainfromLlmAndApiDocs(BaseLanguageModel llm, String apiDocs) static ApiChainfromLlmAndApiDocs(BaseLanguageModel llm, String apiDocs, Map<String, String> headers, BasePromptTemplate apiUrlPrompt, BasePromptTemplate apiResponsePrompt) 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.
-
Constructor Details
-
ApiChain
public ApiChain(LLMChain apiRequestChain, LLMChain apiAnswerChain, TextRequestsWrapper requestsWrapper, String apiDocs)
-
-
Method Details
-
inputKeys
Description copied from class:ChainRetrieves the list of input keys that this chain expects. -
outputKeys
Description copied from class:ChainRetrieves the list of output keys that this chain expects.- Specified by:
outputKeysin classChain- Returns:
- the list of output keys
-
innerCall
Description copied from class:ChainRuns the logic of this chain and returns the output. -
fromLlmAndApiDocs
-
fromLlmAndApiDocs
public static ApiChain fromLlmAndApiDocs(BaseLanguageModel llm, String apiDocs, Map<String, String> headers, BasePromptTemplate apiUrlPrompt, BasePromptTemplate apiResponsePrompt) -
chainType
-