Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tokenizer improvements via Singleton class and estimation #3072

Merged
merged 4 commits into from
Jan 31, 2025

Conversation

timothycarambat
Copy link
Member

@timothycarambat timothycarambat commented Jan 31, 2025

Pull Request Type

  • ✨ feat
  • πŸ› fix
  • ♻️ refactor
  • πŸ’„ style
  • πŸ”¨ chore
  • πŸ“ docs

Relevant Issues

resolves #3069

What is in this change?

  • Moves getEncoding function to a singleton type class to prevent multiple reallocation and initialization calls from uploading files or performance tracking chat text tokens.
  • removes .length from tokenizeString calls since it now returns a number and not an array
  • Will do approx string count estimation and at ~10kb of size we will do a simple mathmatical approximation
  • Added JSDoc to functions as well

Additional Information

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

@timothycarambat timothycarambat changed the title Add tokenizer improvments via Singleton class Add tokenizer improvments via Singleton class and estimation Jan 31, 2025
@timothycarambat timothycarambat changed the title Add tokenizer improvments via Singleton class and estimation Add tokenizer improvements via Singleton class and estimation Jan 31, 2025
@timothycarambat timothycarambat merged commit d1ca16f into master Jan 31, 2025
1 check passed
@timothycarambat timothycarambat deleted the 3069-tokenizer-collector-improvements branch January 31, 2025 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: performance - tokenizeString runs unnecessary when EMBEDDING_ENGINE is not β€˜openai’
1 participant