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<Record<string, any>>

      Returns Record<string, unknown>

llmChain: LLMChain<string, LLMType>

Methods

  • Compresses a list of documents based on the output of an LLM chain.

    Parameters

    • documents: DocumentInterface<Record<string, any>>[]

      The list of documents to be compressed.

    • query: string

      The query to be used for document compression.

    Returns Promise<DocumentInterface<Record<string, any>>[]>

    A list of compressed documents.

Generated using TypeDoc