Help us shape the future of Go! Take the 2026 Go Developer Survey

context

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assembler

type Assembler struct {
	Provider Provider
	Budget   Budget
}

Assembler orchestrates provider and budget components.

func (Assembler) Assemble

func (a Assembler) Assemble(input string) []model.ChatMessage

Assemble builds final messages from input through provider and budget.

func (Assembler) AssembleWithTools

func (a Assembler) AssembleWithTools(input string, specs []model.ToolSpec) []model.ChatMessage

AssembleWithTools builds messages and applies budgeting with tool schema overhead.

type Budget

type Budget struct {
	ModelName string
}

Budget enforces token limits on message history.

func (Budget) Apply

func (b Budget) Apply(msgs []model.ChatMessage) []model.ChatMessage

Apply trims messages to fit within the model's context window budget.

func (Budget) ApplyWithTools

func (b Budget) ApplyWithTools(msgs []model.ChatMessage, specs []model.ToolSpec) []model.ChatMessage

ApplyWithTools trims messages accounting for tool schema token overhead. If specs is nil it behaves like the legacy Apply.

type Provider

type Provider struct {
	Prompt  string
	History []memory.Step
}

Provider builds chat messages from prompt, history, and user input.

func (Provider) Provide

func (p Provider) Provide(input string) []model.ChatMessage

Provide assembles context messages with limited history to prevent exponential growth.

Jump to

Keyboard shortcuts

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