Skip to content

Commit

Permalink
Remove verbose error logging from token estimation function
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Sep 25, 2024
1 parent 5e6c079 commit 37b8a38
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions packages/core/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export function estimateTokens(text: string, encoder: TokenEncoder) {
// Return the length of the encoded text plus a constant overhead
return encoder(text).length + ESTIMATE_TOKEN_OVERHEAD
} catch (e) {
// If encoding fails, log the error in verbose mode
logVerbose(e)
// Fallback: Estimate token count as one-fourth of text length plus overhead
// This provides a rough estimate in case of encoding errors
return (text.length >> 2) + ESTIMATE_TOKEN_OVERHEAD
Expand Down

0 comments on commit 37b8a38

Please sign in to comment.