SIGN IN SIGN UP

Add response wrappers for OpenAI Responses API streams. (#4280)

* Add response wrappers for OpenAI Responses API streams.

* Enhance docstrings for ResponseStreamWrapper and ResponseStreamManagerWrapper to include references to the OpenAI SDK source. This improves clarity on the functionality and origin of the wrappers.

* Add wrappers for OpenAI Responses API streams and response stream managers in CHANGELOG.md

* Refactor response handling in OpenAI response wrappers to improve event processing and error handling. Introduced conditional imports for response events and error types, ensuring compatibility with missing modules. Updated event processing logic to utilize a consolidated response events tuple.

* Refactor OpenAI response wrappers to enhance error handling and event processing. Introduced context managers for safe instrumentation, improved import handling for response events, and streamlined response attribute extraction logic.

* Add unit tests for ResponseStreamManagerWrapper to validate error handling and stream finalization behavior.

* Remove unnecessary blank line in test_response_wrappers.py to improve code cleanliness.

* Refactor event handling in ResponseStreamWrapper to simplify type checks for response events. Removed unnecessary conditional checks for event types, enhancing code clarity and maintainability.

* Enhance ResponseStreamWrapper and ResponseStreamManagerWrapper with improved error handling and context management. Introduced ExitStack for better resource management and added NotImplementedError for unimplemented parse methods. Updated TODO comments for future refactoring with wrapt.ObjectProxy.
T
Teja committed
4df92e287ab5feee0c8ec6017e9d3b4d1bb38355
Parent: ff7f60e
Committed by GitHub <noreply@github.com> on 3/10/2026, 4:06:34 AM