Skip to main content

Module token

Module token 

Source
Expand description

Token estimation using character-based heuristics.

Core functions re-exported from behest-core. Store-dependent estimation functions are defined here.

Functionsยง

estimate_content_part_tokens
Estimates the token count for a content part.
estimate_message_tokens
Estimates the total token count for a provider Message.
estimate_messages_tokens
Estimates the total token count for a slice of provider Messages.
estimate_record_tokens
Estimates the token count for a store MessageRecord.
estimate_records_tokens
Estimates the total token count for a slice of MessageRecords.
estimate_tokens
Estimates the number of tokens for a string.
estimate_tool_call_tokens
Estimates the token count for a tool call.