You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request introduces a new function _truncate_summary in the validmind/ai/test_descriptions.py file to handle the truncation of summaries that exceed a specified maximum token length. The function uses the tiktoken library to encode the summary and ensure it does not exceed the max_tokens limit, which is set to 100,000 by default. If the summary exceeds this limit, it is truncated, and a warning is logged to indicate that the generated description may be inaccurate.
Additionally, the generate_description function has been updated to use _truncate_summary for the summary field, ensuring that summaries are appropriately truncated before being returned.
The error handling in the wrapped function has been improved to provide more specific warnings when a test result is too large to generate a description, and a default description is used instead.
Minor import reordering has been done in validmind/tests/run.py to adhere to standard import ordering practices.
Test Suggestions
Test the _truncate_summary function with summaries of varying lengths to ensure it correctly truncates when necessary.
Verify that the generate_description function integrates _truncate_summary correctly and returns truncated summaries when appropriate.
Check the logging output to ensure that warnings are logged correctly when summaries are truncated or when default descriptions are used.
Test the error handling in the wrapped function to ensure it logs the correct warnings for different types of exceptions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workinginternalNot to be externalized in the release notes
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Internal Notes for Reviewers
Hotfix for issue with context length exceeded errors.
External Release Notes