Repository navigation
fix: honor runtime streaming callback precedence - #13405
shuaiyafei wants to merge 1 commit into
Conversation
|
@shuaiyafei is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @shuaiyafei, thanks a lot for your contribution! 🙏 We noticed that the Contributor License Agreement (CLA) check ( To get your PR reviewed, please sign the CLA via the link in the |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
|
|
Related Issues
Found through source inspection and reproduced locally. No existing issue is claimed.
Proposed Changes
Honor the documented priority of a runtime streaming callback before checking execution-context compatibility.
Currently, an unused async initialization callback makes a synchronous run fail even when a valid synchronous runtime callback replaces it. Conversely, an unused sync initialization callback produces an event-loop-blocking warning when the selected runtime callback is async.
Validate the initialization callback only when it will be used. Select a provided runtime callback by checking for
None, so an empty callable collector is not silently replaced by the initialization callback.The existing rejection of a selected async callback in a synchronous context and the warning for a selected sync callback in an async context remain covered.
How did you test it?
hatch run test:unit test/dataclasses/test_streaming_chunk.py test/components/generators/chat/test_openai.py -q: 97 passed, 12 deselected. Integration tests are excluded by the unit-test command.hatch run test:typeson both changed Python files: passed.hatch run fmton both changed Python files and changed-file pre-commit checks: passed.Tested with Python 3.12.15 on macOS arm64. No live provider request or full-suite run was performed.
Notes for the reviewer
This restores the existing callback-priority contract without adding an API or dependency. The function docstring and a Reno bug-fix note describe the behavior.
This PR was fully generated with Codex. The changed paths were reviewed locally and verified with the tests and checks above.
Checklist