config

package
v0.3.39 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEnvFile = ".env.local"

	ProviderFake             = "fake"
	ProviderOpenAICompatible = "openai-compatible"

	DefaultAgentProfileID     = "floret"
	DefaultFloretSystemPrompt = "You are Floret."
)
View Source
const (
	MinSupportedContextWindowTokens     int64 = 256000
	DefaultContextWindowTokens          int64 = MinSupportedContextWindowTokens
	DefaultMaxOutputTokens              int64 = 0
	DefaultReservedOutputTokens         int64 = 64000
	DefaultAutoCompactRatioPercent      int64 = 90
	DefaultCompactedContextTargetTokens int64 = 50000
	DefaultReservedSummaryTokens        int64 = 20000
	DefaultRecentTailTokens             int64 = 12000
	DefaultRecentUserTokens             int64 = 15000
	DefaultCheckpointOverheadTokens     int64 = 2000
	DefaultEstimatorSource                    = "generic_conservative"
	DefaultEstimatorMethod                    = EstimateMethodMessageContext
)

Variables

This section is empty.

Functions

func PromptCacheRetention

func PromptCacheRetention(cfg Config) (string, error)

func ValidateReasoningLevel added in v0.3.19

func ValidateReasoningLevel(level ReasoningLevel) bool

Types

type AgentProfile

type AgentProfile struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Description  string `json:"description,omitempty"`
	SystemPrompt string `json:"system_prompt"`
}

func DefaultFloretAgentProfile

func DefaultFloretAgentProfile() AgentProfile

func ResolveAgentProfile

func ResolveAgentProfile(profile AgentProfile, systemPrompt string) AgentProfile

type Config

type Config struct {
	Provider string
	Model    string
	BaseURL  string
	APIKey   string

	FakeResponse string

	PromptCacheRetention    string
	SystemPrompt            string
	AgentProfile            AgentProfile
	PromptIdentity          PromptIdentity
	SkillsEnabled           bool
	SkillSources            []string
	SkillPromptBudgetBytes  int
	ContextPolicy           ContextPolicy
	Reasoning               ReasoningSelection
	MaxOutputTokensSet      bool
	MaxEmptyProviderRetries int
	NoProgressLimit         int
	DuplicateToolLimit      int
	WallTime                time.Duration
	// contains filtered or unexported fields
}

func Load

func Load(opts ...Option) (Config, error)

func Resolve

func Resolve(cfg Config, environ map[string]string) (Config, error)

func ResolveEnvSystemPrompt

func ResolveEnvSystemPrompt(systemPrompt string) Config

func ResolvePrompt

func ResolvePrompt(cfg Config) Config

type ContextPolicy added in v0.3.0

type ContextPolicy struct {
	ContextWindowTokens          int64          `json:"context_window_tokens,omitempty"`
	MaxOutputTokens              int64          `json:"max_output_tokens,omitempty"`
	ReservedOutputTokens         int64          `json:"reserved_output_tokens,omitempty"`
	ReservedSummaryTokens        int64          `json:"reserved_summary_tokens,omitempty"`
	RecentTailTokens             int64          `json:"recent_tail_tokens,omitempty"`
	RecentUserTokens             int64          `json:"recent_user_tokens,omitempty"`
	CompactedContextTargetTokens int64          `json:"compacted_context_target_tokens,omitempty"`
	EstimatorSource              string         `json:"estimator_source,omitempty"`
	EstimatorMethod              EstimateMethod `json:"estimator_method,omitempty"`
	MaxCompactionFailures        int            `json:"max_compaction_failures,omitempty"`
}

type ContextPressure added in v0.3.0

type ContextPressure struct {
	WindowInputTokens    int64              `json:"window_input_tokens,omitempty"`
	ProjectedInputTokens int64              `json:"projected_input_tokens,omitempty"`
	ContextWindowTokens  int64              `json:"context_window_tokens,omitempty"`
	ThresholdTokens      int64              `json:"threshold_tokens,omitempty"`
	RequestSafeLimit     int64              `json:"request_safe_limit_tokens,omitempty"`
	OutputHeadroomTokens int64              `json:"output_headroom_tokens,omitempty"`
	Signal               PressureSignal     `json:"pressure_signal,omitempty"`
	Source               PressureSource     `json:"pressure_source,omitempty"`
	EstimateMethod       EstimateMethod     `json:"estimate_method,omitempty"`
	Confidence           EstimateConfidence `json:"confidence,omitempty"`
	CompactionNeeded     bool               `json:"compaction_needed,omitempty"`
	HardLimitExceeded    bool               `json:"hard_limit_exceeded,omitempty"`
}

type ContextUsage added in v0.3.0

type ContextUsage struct {
	PrefixTokens      int64              `json:"prefix_tokens,omitempty"`
	MessageTokens     int64              `json:"message_tokens,omitempty"`
	InputTokens       int64              `json:"input_tokens,omitempty"`
	ContextWindow     int64              `json:"context_window,omitempty"`
	ThresholdTokens   int64              `json:"threshold_tokens,omitempty"`
	RatioLimitTokens  int64              `json:"ratio_limit_tokens,omitempty"`
	RequestSafeLimit  int64              `json:"request_safe_limit_tokens,omitempty"`
	MaxOutputTokens   int64              `json:"max_output_tokens,omitempty"`
	ReservedOutput    int64              `json:"reserved_output,omitempty"`
	ReservedSummary   int64              `json:"reserved_summary,omitempty"`
	OutputHeadroom    int64              `json:"output_headroom_tokens,omitempty"`
	AutoCompactRatio  int64              `json:"auto_compact_ratio_pct,omitempty"`
	RecentTailTokens  int64              `json:"recent_tail_tokens,omitempty"`
	RecentUserTokens  int64              `json:"recent_user_tokens,omitempty"`
	Source            string             `json:"source,omitempty"`
	Method            EstimateMethod     `json:"method,omitempty"`
	Confidence        EstimateConfidence `json:"confidence,omitempty"`
	CompactionNeeded  bool               `json:"compaction_needed,omitempty"`
	HardLimitExceeded bool               `json:"hard_limit_exceeded,omitempty"`
}

type EstimateConfidence added in v0.3.0

type EstimateConfidence string
const (
	EstimateExact        EstimateConfidence = "exact"
	EstimateApproximate  EstimateConfidence = "approximate"
	EstimateConservative EstimateConfidence = "conservative"
)

type EstimateMethod added in v0.3.0

type EstimateMethod string
const (
	EstimateMethodGenericPayload          EstimateMethod = "generic_payload_estimate"
	EstimateMethodProviderRenderedPayload EstimateMethod = "provider_rendered_payload_estimate"
	EstimateMethodMessageContext          EstimateMethod = "message_context_estimate"
	EstimateMethodOfficialPreflightCount  EstimateMethod = "official_preflight_count"
	EstimateMethodUnknown                 EstimateMethod = "unknown_estimate_method"
)

type Option

type Option func(*loader)

func WithEnviron

func WithEnviron(environ map[string]string) Option

func WithPath

func WithPath(path string) Option

type PressureSignal added in v0.3.0

type PressureSignal string
const (
	PressureSignalNativeUsage PressureSignal = "native_usage"
	PressureSignalProjected   PressureSignal = "projected_request"
	PressureSignalOverflow    PressureSignal = "provider_overflow"
	PressureSignalManual      PressureSignal = "manual"
)

type PressureSource added in v0.3.0

type PressureSource string
const (
	PressureSourceProviderUsage       PressureSource = "provider_usage"
	PressureSourceUsageAnchoredDelta  PressureSource = "usage_anchored_delta"
	PressureSourceFullRequestEstimate PressureSource = "full_request_estimate"
	PressureSourceMissingNativeUsage  PressureSource = "missing_native_usage_request_estimate"
	PressureSourceManual              PressureSource = "manual"
)

type PromptIdentity

type PromptIdentity struct {
	AgentProfileID   string       `json:"agent_profile_id"`
	AgentProfileName string       `json:"agent_profile_name"`
	SystemPromptHash string       `json:"system_prompt_hash"`
	Source           PromptSource `json:"source"`
}

type PromptSource

type PromptSource string
const (
	PromptSourceSystemPromptOverride PromptSource = "system_prompt_override"
	PromptSourceAgentProfile         PromptSource = "agent_profile"
	PromptSourceEnv                  PromptSource = "env"
	PromptSourceDefaultFloret        PromptSource = "default_floret"
)

type ReasoningBudget added in v0.3.19

type ReasoningBudget struct {
	MinTokens int64 `json:"min_tokens,omitempty"`
	MaxTokens int64 `json:"max_tokens,omitempty"`
}

type ReasoningCapability added in v0.3.19

type ReasoningCapability struct {
	Kind              string           `json:"kind"`
	SupportedLevels   []ReasoningLevel `json:"supported_levels,omitempty"`
	DefaultLevel      ReasoningLevel   `json:"default_level,omitempty"`
	DisableSupported  bool             `json:"disable_supported,omitempty"`
	DefaultEnabled    *bool            `json:"default_enabled,omitempty"`
	Budget            ReasoningBudget  `json:"budget,omitempty"`
	DynamicModelValue bool             `json:"dynamic_model_value,omitempty"`
}

type ReasoningLevel added in v0.3.19

type ReasoningLevel string

ReasoningLevel is a provider-neutral model reasoning intent. Provider adapters translate it into the model-specific wire shape advertised by the selected model capability.

const (
	ReasoningLevelDefault ReasoningLevel = "default"
	ReasoningLevelOff     ReasoningLevel = "off"
	ReasoningLevelMinimal ReasoningLevel = "minimal"
	ReasoningLevelLow     ReasoningLevel = "low"
	ReasoningLevelMedium  ReasoningLevel = "medium"
	ReasoningLevelHigh    ReasoningLevel = "high"
	ReasoningLevelXHigh   ReasoningLevel = "xhigh"
	ReasoningLevelMax     ReasoningLevel = "max"
)

type ReasoningSelection added in v0.3.19

type ReasoningSelection struct {
	Level        ReasoningLevel `json:"level,omitempty"`
	BudgetTokens int64          `json:"budget_tokens,omitempty"`
}

func NormalizeReasoningSelection added in v0.3.19

func NormalizeReasoningSelection(s ReasoningSelection) ReasoningSelection

func (ReasoningSelection) IsZero added in v0.3.19

func (s ReasoningSelection) IsZero() bool

type RequestEstimate added in v0.3.0

type RequestEstimate struct {
	PrefixTokens         int64              `json:"prefix_tokens,omitempty"`
	MessageTokens        int64              `json:"message_tokens,omitempty"`
	ToolDefinitionTokens int64              `json:"tool_definition_tokens,omitempty"`
	EstimatedInputTokens int64              `json:"estimated_input_tokens,omitempty"`
	Source               string             `json:"source,omitempty"`
	Method               EstimateMethod     `json:"method,omitempty"`
	Confidence           EstimateConfidence `json:"confidence,omitempty"`
}

Jump to

Keyboard shortcuts

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