compact

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CavemanMode

type CavemanMode int

CavemanMode options to cover Julius Brussee's caveman mode for more aggressive compacting. see: https://juliusbrussee.github.io/caveman/ License MIT: https://github.com/JuliusBrussee/caveman/blob/main/LICENSE

const (
	// CavemanOff is the default mode uses a normal prompt.
	CavemanOff CavemanMode = iota
	// CavemanLite is: No filler/hedging. Keep articles + full sentences. Professional but tight.
	CavemanLite
	// CavemanFull is: Drop articles, fragments OK, short synonyms. Classic caveman.
	CavemanFull
	// CavemanUltra is the most aggressive mode: Abbreviate (DB/auth/config/req/res/fn/impl), strip conjunctions, arrows for causality (X → Y), one word when one word enough.
	// Be cautious and ensure you've committed your memory files before using this mode - as we tell our kids: "You get what you get, and you don't throw a fit"
	CavemanUltra
)

func ParseCavemanMode

func ParseCavemanMode(s string) CavemanMode

ParseCavemanMode parses a string into a CavemanMode. Unknown values return CavemanOff.

func (CavemanMode) String

func (m CavemanMode) String() string

type Compacter

type Compacter struct {
	// contains filtered or unexported fields
}

func New

func New(embedder embedder, baseUrl string, apiKey string, model string, opts ...Option) *Compacter

func (*Compacter) Close

func (c *Compacter) Close() error

func (*Compacter) Compact

func (c *Compacter) Compact(input string) (string, error)

type Option

type Option func(*Compacter)

Option is a functional option for configuring Compacter.

func WithCavemanMode

func WithCavemanMode(mode CavemanMode) Option

WithCavemanMode enables caveman mode, which Julius Brussee's prompt for reduced token size. Use at your own risk (make sure memory is committed beforehand).

see: https://juliusbrussee.github.io/caveman/

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger sets the logger for the Compacter.

Jump to

Keyboard shortcuts

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