Commit 2f14008
patcherai-opensource-internal[bot]
fix(openai): guard against choices=None in streaming chunk iterators
When a streaming chunk has choices=None, the existing hasattr check passes
but the subsequent iteration raises TypeError. Inside capture_internal_exceptions()
this is silently suppressed, causing the usage capture on the next line to be
skipped — leaving token usage and response text missing from the Sentry span.
Add explicit None checks in both the sync and async streaming iterators.1 parent 7a3dfb0 commit 2f14008
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
839 | 839 | | |
840 | 840 | | |
841 | 841 | | |
842 | | - | |
| 842 | + | |
843 | 843 | | |
844 | 844 | | |
845 | 845 | | |
| |||
901 | 901 | | |
902 | 902 | | |
903 | 903 | | |
904 | | - | |
| 904 | + | |
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
| |||
0 commit comments