Skip to content

Add aclose alias to AsyncStream#2996

Open
LittleChenLiya wants to merge 1 commit intoopenai:mainfrom
LittleChenLiya:fix-asyncstream-aclose
Open

Add aclose alias to AsyncStream#2996
LittleChenLiya wants to merge 1 commit intoopenai:mainfrom
LittleChenLiya:fix-asyncstream-aclose

Conversation

@LittleChenLiya
Copy link

Summary

Add an aclose() alias to AsyncStream for compatibility with async stream consumers that expect the standard close method name.

This keeps AsyncStream aligned with other async response wrappers in the SDK and avoids AttributeError in integrations that call await stream.aclose().

Changes

  • add AsyncStream.aclose() as an alias for close()
  • add regression tests covering the alias and confirming it closes the underlying response

Testing

  • python -m pytest tests/test_streaming.py -k "async_stream_has_aclose_alias or async_stream_aclose_closes_response" -n 0

Closes #2853

@LittleChenLiya LittleChenLiya requested a review from a team as a code owner March 20, 2026 06:42
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.

AsyncStream missing aclose() causes AttributeError in streaming structured output

1 participant