Interface Chain<I,​O>

Type Parameters:
I - the chain input type
O - the chain output type
All Known Implementing Classes:
AzureOpenAiChatChain, CombineDocumentsChain, LargeLanguageModelChain, LuceneRetrievalChain, MapAnswerWithSourcesChain, OpenAiChatChain, RetrievalChain, SummarizeDocumentsChain
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface
public interface Chain<I,​O>
Basic interface for all modular components in this repository. A Chain accepts an input of type *I* and provides an output of type *O*. Using the method chain(Chain) passing another Chain, a new Chain can be created which accepts the original chain's input and provided the new chain's output.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static org.apache.logging.log4j.Logger LOGGER
    The default Logger for Chains
  • Method Summary

    Modifier and Type Method Description
    default <B> Chain<I,​B> chain​(Chain<O,​B> next)
    create a new Chain connecting this instance with another passed one.
    O run​(I input)
    Execute this Chain
  • Field Details

    • LOGGER

      static final org.apache.logging.log4j.Logger LOGGER
      The default Logger for Chains
  • Method Details

    • run

      O run​(I input)
      Execute this Chain
      Parameters:
      input - this chain's input
      Returns:
      this chain's output
    • chain

      default <B> Chain<I,​B> chain​(Chain<O,​B> next)
      create a new Chain connecting this instance with another passed one.
      Type Parameters:
      B - type of the next chain's output
      Parameters:
      next - the next chain which is attached to this instance
      Returns:
      a new Chain consisting of the original Chain and the passed one