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.
Static
fromLLMCreates a new instance of LLMChainExtractor from a given LLM, prompt template, and getInput function.
The BaseLanguageModel instance used for document extraction.
Optional
prompt: anyThe PromptTemplate instance used for document extraction.
Optional
getInput: ((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.
Static
is
A class that uses an LLM chain to extract relevant parts of documents. It extends the BaseDocumentCompressor class.