Skip to content

fix(openai): preserve logprobs for streaming chat spans#215

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
abhi-fix-180-stream-logprobs
Apr 8, 2026
Merged

fix(openai): preserve logprobs for streaming chat spans#215
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
abhi-fix-180-stream-logprobs

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

Accumulate per-chunk logprob content and refusal entries when postprocessing chat completion streams so traced output matches non-streaming calls. Also read finish_reason from the streamed choice and add a VCR regression test for the wrapped sync path.

Closes #180

@starfolkai
Copy link
Copy Markdown
Contributor

starfolkai Bot commented Apr 7, 2026

Drop into this review session: sfk devbox connect pr-215-braintrust-sdk-python-2bd0 --attach

No serious bugs or issues found 🎉

Accumulate per-chunk logprob content and refusal entries when
postprocessing chat completion streams so traced output matches
non-streaming calls. Also read finish_reason from the streamed
choice and add a VCR regression test for the wrapped sync path.

Closes #180
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit fef79f6 into main Apr 8, 2026
39 checks passed
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) deleted the abhi-fix-180-stream-logprobs branch April 8, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BOT ISSUE] OpenAI: chat completions streaming discards logprobs from chunks

2 participants