token

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 2 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassifyTaskComplexity

func ClassifyTaskComplexity(task string) string

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 Entry

type Entry = engine.TokenEntry

Entry records token consumption for a single request.

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

func NewReporter(sessionBudget int) *Reporter

NewReporter returns a token reporter with the given session-wide budget.

Jump to

Keyboard shortcuts

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