Commit a270a98
authored
Fix issue 3355 assertion error (#3356)
* update tests
* Add test to reproduce issue #3355 AssertionError
* update tests
* Fix issue #3355: Handle None values in parse_generations/parse_logprobs
Fixes the AssertionError in Collator.get_original() that occurred when
API responses contain None values. The issue was that the code skipped
None values when building the result list, causing a mismatch between
the expected number of items and actual items, triggering the assertion.
Changes:
- generate_until: Always append results, converting None to empty string
- _loglikelihood_tokens: Always append results, converting None to (-inf, False)
- Applied fix to both sequential and concurrent code paths
The fix ensures:
1. Result lists always have the correct number of items for reordering
2. None values are converted to sensible defaults instead of being skipped
3. Progress bars update correctly for all requests
4. Only successful results are cached
Resolves #3355
* remove irrelevant test
* Remove speculative loglikelihood fixes
Only fix generate_until, which has confirmed evidence of the bug from
issue #3355. The loglikelihood methods have no evidence of this issue:
- No failures reported in issue #3355
- Different code structure in parse_logprobs (no gap creation)
- Stack traces only show generate_until failures
Keep the fix minimal and evidence-based.
* Add warning logs when API returns null content
Log concise warnings when parse_generations returns None to help
users diagnose issues with API responses that have 'content': null.
Warning message suggests checking:
- reasoning_content field (for reasoning models)
- generation limits (max_tokens, length)
Includes first 50 chars of context in sequential path for debugging.
* remove context log1 parent dfe769b commit a270a98
1 file changed
+25
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
772 | | - | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
773 | 780 | | |
774 | 781 | | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | | - | |
779 | | - | |
780 | | - | |
781 | | - | |
782 | | - | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
783 | 790 | | |
784 | 791 | | |
785 | 792 | | |
| |||
809 | 816 | | |
810 | 817 | | |
811 | 818 | | |
812 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
813 | 828 | | |
814 | 829 | | |
815 | 830 | | |
| |||
0 commit comments