Documentation
¶
Overview ¶
Package token is the Stage-1 namespace for token-related types and functions in package engine. See ../REFACTOR_PLAN.md.
New code in hawk should import this package instead of reaching into engine for token symbols. Implementation will move here in Stage 2.
Index ¶
- func ClassifyTaskComplexity(task string) string
- func DynamicMaxTokens(messages []client.EyrieMessage, contextSize int, taskType string) int
- func FormatPrediction(pred *Prediction, model string) string
- func WarnIfExpensive(pred *Prediction, budgetUSD float64) string
- type BudgetAlert
- type Entry
- type Prediction
- type PredictionRecord
- type Predictor
- type Reporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClassifyTaskComplexity ¶
ClassifyTaskComplexity returns a coarse category ("simple", "medium", "complex") inferred from the task text.
func DynamicMaxTokens ¶
func DynamicMaxTokens(messages []client.EyrieMessage, contextSize int, taskType string) int
DynamicMaxTokens chooses a sensible max-tokens value for a given context size and task type, capped to model limits.
func FormatPrediction ¶
func FormatPrediction(pred *Prediction, model string) string
FormatPrediction renders a prediction for display.
func WarnIfExpensive ¶
func WarnIfExpensive(pred *Prediction, budgetUSD float64) string
WarnIfExpensive returns a non-empty warning string when the predicted cost exceeds the budget, otherwise empty.
Types ¶
type BudgetAlert ¶
type BudgetAlert = engine.BudgetAlert
BudgetAlert is raised when token usage crosses a configured threshold.
type Prediction ¶
type Prediction = engine.Prediction
Prediction is the output of a single estimation pass.
type PredictionRecord ¶
type PredictionRecord = engine.PredictionRecord
PredictionRecord is one historical observation backing the predictor.
type Predictor ¶
type Predictor = engine.TokenPredictor
Predictor estimates token usage for upcoming requests based on history.
func NewPredictor ¶
func NewPredictor() *Predictor
NewPredictor returns a fresh empty token predictor.
type Reporter ¶
type Reporter = engine.TokenReporter
Reporter aggregates per-session token consumption + budget alerts.
func NewReporter ¶
NewReporter returns a token reporter with the given session-wide budget.