Skip to content

Separate Token Estimators For OpenAI Models#95

Merged
sepandhaghighi merged 5 commits intodevfrom
separate-token-estimators
Apr 6, 2025
Merged

Separate Token Estimators For OpenAI Models#95
sepandhaghighi merged 5 commits intodevfrom
separate-token-estimators

Conversation

@sadrasabouri
Copy link
Member

@sadrasabouri sadrasabouri commented Apr 5, 2025

Reference Issues/PRs

#67

What does this implement/fix? Explain your changes.

We separated the token estimators for two models of ChatGPT3.5-turbo and 4.
Now we have

  • openai_tokens_estimator_gpt_3_5
  • openai_tokens_estimator_gpt_4

as our estimators instead of openai_tokens_estimator.

Any other comments?

@sepandhaghighi Note that I removed the check for non-str inputs since we're not doing it for the universal estimator, and I wanted them to be more consistent. If we needed them we can add them in a future PR.

@sadrasabouri sadrasabouri added the enhancement New feature or request label Apr 5, 2025
@sadrasabouri sadrasabouri added this to the memor v0.5 milestone Apr 5, 2025
@sadrasabouri sadrasabouri self-assigned this Apr 5, 2025
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.40%. Comparing base (513391f) to head (5d19039).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #95      +/-   ##
==========================================
+ Coverage   98.39%   98.40%   +0.01%     
==========================================
  Files          10       10              
  Lines         992      996       +4     
  Branches      102      100       -2     
==========================================
+ Hits          976      980       +4     
  Misses          7        7              
  Partials        9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sadrasabouri sadrasabouri marked this pull request as ready for review April 5, 2025 01:43

UNIVERSAL = universal_tokens_estimator
OPENAI = openai_tokens_estimator
OPENAI_GPT35_TURBO = openai_tokens_estimator_gpt35_turbo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion: OPENAI_GPT_3_5 instead of OPENAI_GPT35_TURBO

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ GPT_3_5 is better than GPT35 — and here's why:
✔️ Clarity & Readability
GPT_3_5 mirrors the actual model name (gpt-3.5) more closely.

Avoids ambiguity: 35 could be misread as "thirty-five" instead of "3.5".

🔢 Consistency with naming standards
Enum names typically use UPPER_SNAKE_CASE, and separating numbers with underscores (when they represent separate components) improves readability.

UNIVERSAL = universal_tokens_estimator
OPENAI = openai_tokens_estimator
OPENAI_GPT35_TURBO = openai_tokens_estimator_gpt35_turbo
OPENAI_GPT4 = openai_tokens_estimator_gpt4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion: OPENAI_GPT_4 instead of OPENAI_GPT4

Copy link
Member

@sepandhaghighi sepandhaghighi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@sepandhaghighi sepandhaghighi merged commit b6145c6 into dev Apr 6, 2025
26 checks passed
@sepandhaghighi sepandhaghighi deleted the separate-token-estimators branch April 6, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants