refactor: accept sync callbacks in run_async - #11466
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
| @@ -1,18 +0,0 @@ | |||
| # SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai> | |||
There was a problem hiding this comment.
this was only used internally. I moved it to streaming_chunk.py
| with pytest.warns(Warning, match="dataclasses.replace"): | ||
| chunk.content = "other" | ||
|
|
||
|
|
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@mpangrazzi feel free to take a look if you want |
| streaming_callback = select_streaming_callback( | ||
| init_callback=self.streaming_callback, runtime_callback=streaming_callback, requires_async=True | ||
| ) |
There was a problem hiding this comment.
Don't we also need to drop this async enforcement?
There was a problem hiding this comment.
Ahh I see you updated the method so requires_async=True only emits a warning now. I think fair enough, are we not changing the name of the param since the method is public?
It's probably also fine to leave but it does feel a bit odd to say requires_async=True but that now means we only emit a warning. But since it's mostly an internal method it's probably fine to leave.
There was a problem hiding this comment.
I agree with you: I'd prefer to rename the parameter to async_context, as require_async is a bit misleading now.
Unfortunately, this would be a breaking change and I'd like to avoid forcing integrations to bump their Haystack version to 3. Plus, I don't know if this Haystack method is used somewhere else in the ecosystem.
So I'd leave the name unchanged for now. Happy to re-discuss this in the future.
sjrl
left a comment
There was a problem hiding this comment.
Just a minor comment about naming, otherwise looks good!
Related Issues
Proposed Changes:
run_async(with a warning)How did you test it?
CI, new tests
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.