Compresses a list of documents based on the output of an LLM chain.
The list of documents to be compressed.
The query to be used for document compression.
A list of compressed documents.
StaticfromLLMCreates a new instance of LLMChainExtractor from a given LLM, prompt template, and getInput function.
The BaseLanguageModel instance used for document extraction.
Optionalprompt: anyThe PromptTemplate instance used for document extraction.
OptionalgetInput: ((query: string, doc: DocumentInterface) => Record<string, unknown>)A function used for constructing the chain input from the query and a Document.
A new instance of LLMChainExtractor.
Staticis
A class that uses an LLM chain to extract relevant parts of documents. It extends the BaseDocumentCompressor class.