A class that uses an LLM chain to extract relevant parts of documents. It extends the BaseDocumentCompressor class.

Hierarchy

Constructors

Properties

getInput: ((query, doc) => Record<string, unknown>) = defaultGetInput

Type declaration

    • (query, doc): Record<string, unknown>
    • Parameters

      • query: string
      • doc: DocumentInterface

      Returns Record<string, unknown>

llmChain: LLMChain<string, any>

Methods

  • Creates a new instance of LLMChainExtractor from a given LLM, prompt template, and getInput function.

    Parameters

    • llm: BaseLanguageModelInterface

      The BaseLanguageModel instance used for document extraction.

    • Optional prompt: any

      The PromptTemplate instance used for document extraction.

    • Optional getInput: ((query, doc) => Record<string, unknown>)

      A function used for constructing the chain input from the query and a Document.

        • (query, doc): Record<string, unknown>
        • Parameters

          • query: string
          • doc: DocumentInterface

          Returns Record<string, unknown>

    Returns LLMChainExtractor

    A new instance of LLMChainExtractor.

Generated using TypeDoc