Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextUsage ¶
type ContextUsage struct {
TotalTokens int `json:"totalTokens"`
MaxTokens int `json:"maxTokens"`
Percentage float64 `json:"percentage"`
Model string `json:"model"`
Categories map[string]int `json:"categories"`
MessageBreakdown []MessageTokenInfo `json:"messageBreakdown,omitempty"`
}
ContextUsage summarises how much of the context window is consumed.
type MessageTokenInfo ¶
type MessageTokenInfo struct {
Role string `json:"role"`
Tokens int `json:"tokens"`
UUID string `json:"uuid,omitempty"`
}
MessageTokenInfo describes token usage for a single message.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker estimates and tracks context window usage.
func (*Tracker) GetUsage ¶
func (t *Tracker) GetUsage() *ContextUsage
GetUsage returns a copy of the current context usage.
func (*Tracker) SetMaxTokens ¶
SetMaxTokens overrides the maximum context window size.