Skip to main content

internal/recall/controls.go

internal/recall · 101 lines · 5 declarations · source

Declarations

var ErrInvalidControls

var ErrInvalidControls = errors.New("invalid recall controls")

source

type Controls

type Controls struct {
MaxCharacters *int `json:"max_characters,omitempty"`
SourceRoles []string `json:"source_roles,omitempty"`
Hops int `json:"hops,omitempty"`
// Surfaces selects which composed surfaces may answer: facts, reports, passages. Nil is
// all three; an empty list, a repeat or an unknown name is refused.
Surfaces []string `json:"surfaces,omitempty"`
// Themes forces the report surface even when the question anchored, for a caller who wants
// the subjects around an entity as well as the facts about it.
Themes bool `json:"themes,omitempty"`
}

Controls narrows the configured budget and explicitly selects whose assertions are considered. Source selection changes the trust choice, never the authorized projects or subject filter.

source

type EffectiveControls

type EffectiveControls struct {
MaxCharacters int `json:"max_characters"`
MaxRows int `json:"max_rows"`
SourceRoles []string `json:"source_roles"`
Hops int `json:"hops"`
Surfaces []string `json:"surfaces"`
Themes bool `json:"themes"`
}

source

method Recaller.RecallWithControls

func (r *Recaller) RecallWithControls(ctx context.Context, scopes []string, question string, at domain.AsOf, subject string, controls Controls) (domain.Bundle, EffectiveControls, error)

RecallWithControls copies the recaller's small configuration value so simultaneous callers can choose different context windows without mutating shared state or bypassing the server ceiling.

source

func clampHops

func clampHops(hops int) int

source