Skip to content

fix: remove duplicate accumulate_delta in assistants streaming - #3578

Open
bunlongheng wants to merge 1 commit into
openai:mainfrom
bunlongheng:fix/deduplicate-accumulate-delta-in-assistants-streaming
Open

fix: remove duplicate accumulate_delta in assistants streaming#3578
bunlongheng wants to merge 1 commit into
openai:mainfrom
bunlongheng:fix/deduplicate-accumulate-delta-in-assistants-streaming

Conversation

@bunlongheng

Copy link
Copy Markdown

Summary

lib/streaming/_assistants.py contained a private copy of accumulate_delta (lines 983-1041) that was byte-for-byte identical to the canonical version in lib/streaming/_deltas.py:6-64.

The chat streaming path already imports from _deltas (see lib/streaming/chat/_completions.py:25), but assistants streaming maintained its own duplicate - meaning any bugfix to one copy would silently miss the other.

Change

  • Remove the 59-line duplicate from _assistants.py
  • Import accumulate_delta from ._deltas (same as chat streaming already does)
  • Remove the now-unused is_dict/is_list imports from _utils

Verification

ruff check src/openai/lib/streaming/_assistants.py  # all checks passed
pytest tests/lib/test_assistants.py tests/test_streaming.py  # 28 passed

No behavior change - both call sites (lines 910, 961) continue calling the same function, now through the shared import.

@bunlongheng
bunlongheng requested a review from a team as a code owner August 5, 2026 15:35
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.

1 participant