-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add get_task_result_stream to new client #351
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm honestly, nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just had one question on _R
generic param that was introduced and I couldn't see where it was being used?
except RuntimeError: | ||
return _SyncClient(**self.model_dump()) | ||
|
||
msg = "You cannot use the sync client within an async event loop - just await the async methods directly." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, was this something we were running into before. Anyways, nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This problem always existed but didn't run into it until @logan-markewich made me notice!
# Generic parameter for the wrapped generator method | ||
_P = ParamSpec("_P") | ||
# Generic parameter for the wrapped generator method return value | ||
_R = TypeVar("_R") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly dumb question as perhaps I just missed this, but where are we using this generic param?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not dumb, leftover! I'll remove it, good catch!
This PR ports the last method missing from
AsyncSessionClient
,get_task_result_stream
.Fixes #335
Notes for the reviewer:
Coroutine[AsyncGenerator]
when converted withasync_to_sync
returnAsyncGenerator
, that we can't use in sync calls. To overcome this limitation,generator_wrapper
was added that consumes the async generator under the hood and returns a listClient