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
ConstructorDescriptionApiChain
(LLMChain apiRequestChain, LLMChain apiAnswerChain, TextRequestsWrapper requestsWrapper, String apiDocs) -
Method Summary
Modifier and TypeMethodDescriptionstatic ApiChain
fromLlmAndApiDocs
(BaseLanguageModel llm, String apiDocs) static ApiChain
fromLlmAndApiDocs
(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:Chain
Retrieves the list of input keys that this chain expects. -
outputKeys
Description copied from class:Chain
Retrieves the list of output keys that this chain expects.- 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. -
fromLlmAndApiDocs
-
fromLlmAndApiDocs
public static ApiChain fromLlmAndApiDocs(BaseLanguageModel llm, String apiDocs, Map<String, String> headers, BasePromptTemplate apiUrlPrompt, BasePromptTemplate apiResponsePrompt) -
chainType
-