Class BaseCombineDocumentsChain

java.lang.Object
com.hw.langchain.chains.base.Chain
com.hw.langchain.chains.combine.documents.base.BaseCombineDocumentsChain
Direct Known Subclasses:
StuffDocumentsChain

public abstract class BaseCombineDocumentsChain extends Chain
Base interface for chains combining documents.
Author:
HamaWhite
  • Field Details

    • inputKey

      protected String inputKey
    • outputKey

      protected String outputKey
  • Constructor Details

    • BaseCombineDocumentsChain

      public BaseCombineDocumentsChain()
  • Method Details

    • inputKeys

      public List<String> inputKeys()
      Description copied from class: Chain
      Retrieves the list of input keys that this chain expects.
      Specified by:
      inputKeys in class Chain
      Returns:
      the list of input keys
    • outputKeys

      public List<String> outputKeys()
      Description copied from class: Chain
      Retrieves the list of output keys that this chain expects.
      Specified by:
      outputKeys in class Chain
      Returns:
      the list of output keys
    • promptLength

      public Optional<Integer> promptLength(List<Document> docs, Map<String,Object> kwargs)
      Return the prompt length given the documents passed in. Returns None if the method does not depend on the prompt length.
    • combineDocs

      public abstract org.apache.commons.lang3.tuple.Pair<String,Map<String,String>> combineDocs(List<Document> docs, Map<String,Object> kwargs)
      Combine documents into a single string.
    • asyncCombineDocs

      public abstract reactor.core.publisher.Flux<org.apache.commons.lang3.tuple.Pair<String,Map<String,String>>> asyncCombineDocs(List<Document> docs, Map<String,Object> kwargs)
      Combine documents into a single string async.
    • innerCall

      protected Map<String,String> innerCall(Map<String,Object> inputs)
      Description copied from class: Chain
      Runs the logic of this chain and returns the output.
      Specified by:
      innerCall in class Chain
      Parameters:
      inputs - the inputs to be processed by the chain
      Returns:
      a map containing the output generated by the chain
    • asyncInnerCall

      protected reactor.core.publisher.Flux<Map<String,String>> asyncInnerCall(Map<String,Object> inputs)
      Description copied from class: Chain
      Runs the logic of this chain and returns the async output.
      Overrides:
      asyncInnerCall in class Chain
      Parameters:
      inputs - the inputs to be processed by the chain
      Returns:
      a map flux containing the output generated event by the chain