compact

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package compact implements the /compact slash command logic and idle autocompaction summarisation.

Summarize asks a throwaway client on the compact model to summarise the conversation using SummaryPrompt. The summary is then either carried forward into a fresh session via BuildCarryOver (/compact) or applied in place (idle autocompaction). The session's own client is never reused.

Index

Constants

This section is empty.

Variables

View Source
var SummaryPrompt string

Functions

func BuildCarryOver

func BuildCarryOver(summary string) string

BuildCarryOver formats the summary produced by the old session into the opening user message for the new session.

func Summarize added in v0.3.0

func Summarize(ctx context.Context, apiKey string, m model.ID, genOpts model.GenerationOptions, history []message.Message, opts ...client.Option) (string, error)

Summarize asks the compact model for a summary of history. The history snapshot is sent as-is, followed by a hidden SummaryPrompt user message. The session client is not used: a throwaway client is built with no tools and prompt caching disabled. opts configures additional transport options (e.g. client.WithProviderPreferences).

Types

This section is empty.

Source Files

  • compact.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL