token

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: AGPL-3.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAPIKey = errors.New("ANTHROPIC_API_KEY environment variable not set")

Functions

func EstimateDocScoutTokens

func EstimateDocScoutTokens(i int) int

EstimateDocScoutTokens returns the estimated token cost when using DocScout tools to answer question at index i. Returns 0 for out-of-range indices.

func EstimateNaiveTokens

func EstimateNaiveTokens(i int) int

EstimateNaiveTokens returns the estimated token cost for a naive AI (no DocScout) to answer question at index i. Returns 0 for out-of-range indices.

func SavingsPct

func SavingsPct(docscout, naive int) float64

SavingsPct returns the percentage of tokens saved by using DocScout vs naive.

Types

type LiveResult

type LiveResult struct {
	Index int

	Question string

	DocScoutToks int

	NaiveToks int

	SavingsPct float64
}

type LiveRunner

type LiveRunner struct {
	// contains filtered or unexported fields
}

func NewLiveRunner

func NewLiveRunner(_ context.Context) (*LiveRunner, error)

func (*LiveRunner) MeasureQuestion

func (r *LiveRunner) MeasureQuestion(ctx context.Context, idx int, question, docscoutContext, naiveContext string) (LiveResult, error)

type QuestionEstimate

type QuestionEstimate struct {
	Index        int
	DocScoutToks int
	NaiveToks    int
	SavingsPct   float64
}

QuestionEstimate holds theoretical token estimates for one canonical question.

func AllEstimates

func AllEstimates() []QuestionEstimate

AllEstimates returns theoretical estimates for all 12 canonical questions.

Jump to

Keyboard shortcuts

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