Predicted tokens support in instructor#1312
Closed
sreeprasannar wants to merge 2 commits into567-labs:mainfrom
Closed
Predicted tokens support in instructor#1312sreeprasannar wants to merge 2 commits into567-labs:mainfrom
sreeprasannar wants to merge 2 commits into567-labs:mainfrom
Conversation
…ompletion usage only relevant when `prediction` is in the input field -- otherwise will default to 0
Contributor
There was a problem hiding this comment.
👍 Looks good to me! Reviewed everything up to 3f38122 in 21 seconds
More details
- Looked at
53lines of code in2files - Skipped
0files when reviewing. - Skipped posting
2drafted comments based on config settings.
1. tests/llm/test_openai/test_predicted_outputs.py:3
- Draft comment:
Theclientparameter is not initialized in this test function. Ensure thatclientis properly set up before using it in the test. - Reason this comment was not posted:
Confidence changes required:80%
The test function is missing a proper setup for theclientparameter, which is crucial for the test to run correctly. This could lead to test failures or unexpected behavior.
2. tests/llm/test_openai/test_predicted_outputs.py:33
- Draft comment:
Assertions should include error messages for better debugging. This applies to both assertions in this file. - Reason this comment was not posted:
Confidence changes required:80%
The assertions in the test file lack error messages, which is against the rule that assertions should always have an error message.
Workflow ID: wflow_01M0obeWPvzXT3GQ
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#1145 is trivially supported by instructor (since we just pass on the kwargs to the openai endpoint). This PR bubbles up predicted tokens details in the total usage in
update_total_usagefrom the response which can be useful for callers.Also added a test to demonstrate the correct behaviour
Important
Add tracking of predicted tokens in
update_total_usageand test intest_predicted_outputs.py.update_total_usageinutils.pynow tracksaccepted_prediction_tokensandrejected_prediction_tokensfromcompletion_tokens_details.test_predicted_outputsintest_predicted_outputs.pyverifies tracking of predicted tokens in response usage.This description was created by
for 3f38122. It will automatically update as commits are pushed.