headless_lms_chatbot::azure_chatbot

Function estimate_tokens

Source
pub fn estimate_tokens(text: &str) -> i32
Expand description

Estimate the number of tokens in a given text. We use this for example to estimate the expense of a chat request. The result is not accurate but it is cheap to calculate.