Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateTokens ¶
EstimateTokens returns an approximate token count for the given text. Heuristic: calibrated to cl100k_base tokenization used by Claude and GPT-4. Accuracy: ±15% for typical English prose; may undercount for code or non-ASCII.
func FormatMemoriesWithBudget ¶
FormatMemoriesWithBudget formats multiple memory strings within a token budget. Returns the formatted string and the number of memories that fit.
func TruncateToTokenBudget ¶
TruncateToTokenBudget truncates text to approximately fit within a token budget.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.