TomTom Maps for JavaScript
    Preparing search index...

    Type Alias CompactMessagesOptions

    Options passed to compactMessages.

    type CompactMessagesOptions = {
        instructions?: string;
        keepTurns: number;
        maxWords?: number;
        messages: readonly ModelMessage[];
        model: LanguageModel;
        summary?: string;
    }
    Index
    instructions?: string

    What the summary keeps and drops, and whose memory it is.

    By default, COMPACT_MESSAGES_INSTRUCTIONS. To extend it rather than replace it, append your own sentences to that constant.

    keepTurns: number

    How many of the latest turns to keep word for word.

    A turn starts at a user message and runs up to the next one, so an assistant message calling tools always stays with the tool messages holding their results. With 0, every message is folded.

    maxWords?: number

    The summary's maximum length, in words. Default: 150.

    messages: readonly ModelMessage[]

    The conversation since the last compaction, oldest first.

    model: LanguageModel

    The language model that writes the summary, ideally a fast, low-cost one.

    summary?: string

    The summary the previous compaction returned, which the new one carries on.