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

fix: calculate estimated tokens for openai only #3070

Conversation

louishalbritter
Copy link

Pull Request Type

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

Relevant Issues

resolves #3069

What is in this change?

The function tokenizeString is very CPU-intensive. Its only use I found is here to estimate embedding costs for OpenAI:

// Do not do cost estimation unless the embedding engine is OpenAi.
if (systemSettings?.EmbeddingEngine === "openai") {

When run against a local LLM provider, this function isn’t necessary, thus saving significant time and energy.

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
Copy link
Member

Moving to #3072

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’
2 participants