prompt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompt

type Prompt struct {
	System string
	User   string
}

Prompt is the assembled (system, user) pair ready to hand to a Provider. Use Build to construct it.

func Build

func Build(rulesLoaded, outputLoaded rules.Loaded, langRes lang.Resolution, diffText string) Prompt

Build assembles the system prompt (rules + output format + lang directive + prompt-injection guard) and the user prompt (diff fenced block) into a single value. Pass rules.DefaultOutput() if the caller has not resolved a per-user OUTPUT.md override.

func (Prompt) EstimatedTokens

func (p Prompt) EstimatedTokens() int

EstimatedTokens uses the chars/4 heuristic shared with internal/diff. Provider-side token counts override this; the value is intended for pre-flight checks and dry-run reporting.

func (Prompt) ExceedsContext

func (p Prompt) ExceedsContext(contextWindow int) bool

ExceedsContext reports whether the estimated token count is larger than the provider's reported context window. Callers should branch on this before sending a request so users get a friendlier error than a provider-side 400.

Jump to

Keyboard shortcuts

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