test(openai): add vcr regression coverage for stream helper#214
Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit intomainfrom Apr 7, 2026
Merged
Conversation
|
Drop into this review session: No serious bugs or issues found 🎉 |
eda75fc to
2d5e3d9
Compare
Add explicit sync and async VCR tests for both chat.completions.stream() and responses.stream() and verify the helper paths produce Braintrust spans when the client is wrapped.\n\nAlso keep coverage for the OpenAIIntegration.setup() path so global instrumentation continues to trace the stream helpers and preserve helper-specific behavior.\n\nThese tests cover the regressions discussed in #114 and #170.
2d5e3d9 to
2a2505d
Compare
Andrew Kent (realark)
approved these changes
Apr 7, 2026
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.
AI Summary
Add VCR regression coverage for OpenAI stream helper APIs.
This PR extends the existing
chat.completions.stream()coverage to also testresponses.stream()in both sync and async flows. The new tests verify that:This covers regression cases related to:
chat.completions.stream()helper method not instrumented #114 —chat.completions.stream()responses.stream()helper method not instrumented #170 —responses.stream()What changed
Added tests
responses.stream()get_final_response()still worksAdded cassettes
test_openai_responses_stream_helper.yamltest_openai_responses_stream_helper_async.yamlWhy
responses.stream()is a first-class OpenAI SDK helper and should stay covered by regression tests the same waychat.completions.stream()is. Current instrumentation works through the existing wrapped streaming path, but there was no explicit VCR coverage protecting that behavior.Test strategy
Used a red/green approach:
Validation
Targeted test run:
Passed:
test_openai_responses_stream_helpertest_openai_responses_stream_helper_async