-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Refactor transform_messages #1631
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1631 +/- ##
===========================================
+ Coverage 39.33% 61.97% +22.63%
===========================================
Files 57 57
Lines 6096 6093 -3
Branches 1365 1481 +116
===========================================
+ Hits 2398 3776 +1378
+ Misses 3502 1974 -1528
- Partials 196 343 +147
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@microsoft-github-policy-service agree |
… size and then iterate by token.
4e4cbb4
to
fb0e28a
Compare
Your changes made sense. I pulled them into the PR. |
Thank you so much @dkirsche! Also, I think we need to improve this function to handle the case when the message history has tool_calls and responses. But we can fix this in a new PR. |
Some of the checks are in a waiting state. @ekzhu I believe I need your review before proceeding. |
* refactored code to simplify * optimize function. Instead of iterating over each character, guess at size and then iterate by token. * adding tests * Add missing tests * minor test fix * simplified token truncation by using tiktoken to encode and decode * updated truncated notification message * Fix llm_config spec to use os.environ * Add test case and fix bug in loop --------- Co-authored-by: gagb <[email protected]>
Why are these changes needed?
Some small refactors to improve readabilty, simplify and optimize.
Improvements
Related issue number
None
Checks