@its-iris/llmlingua-2
    Preparing search index...

    Class PromptCompressor

    The TypeScript implementation on original PromptCompressor, which is a class for compressing prompts using a language model.

    Index

    Constructors

    Methods

    Constructors

    • Parameters

      • model: PreTrainedModel

        The pre-trained model to use for compression.

      • tokenizer: PreTrainedTokenizer

        The pre-trained tokenizer to use for compression.

      • getPureToken: GetPureTokenFunction

        Function to get the pure token from a token. This is used to normalize tokens before processing.

      • isBeginOfNewWord: IsBeginOfNewWordFunction

        Function to check if a token is the beginning of a new word. This is used to determine how to merge tokens into words.

      • oaiTokenizer: { encode: (text: string) => { length: number } }

        The tokenizer to use calculating the compression rate. It needs to return a collection that exposes length.

      • llmlingua2Config: LLMLingua2Config = DEFAULT_LLMLINGUA2_CONFIG

        Configuration for LLMLingua2.

      • logger: Logger = DEFAULT_LOGGER

        Logger function to log messages.

      Returns PromptCompressor

    Methods