-
-
Notifications
You must be signed in to change notification settings - Fork 686
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
fix: max_retries
typing
#1135
fix: max_retries
typing
#1135
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.
👍 Looks good to me! Reviewed everything up to fce914c in 20 seconds
More details
- Looked at
230
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. instructor/patch.py:43
- Draft comment:
Ensure thatmax_retries
is handled correctly when it is an instance ofRetrying
orAsyncRetrying
. The current logic seems to assume it is always an integer. - Reason this comment was not posted:
Confidence changes required:80%
The type hint formax_retries
is updated to includeRetrying
andAsyncRetrying
, but the logic for handling these types is not clear. The code should ensure thatmax_retries
is used correctly when it is an instance ofRetrying
orAsyncRetrying
.
2. instructor/client.py:118
- Draft comment:
Themax_retries
parameter has been updated to acceptint | Retrying | AsyncRetrying
in multiple functions. Ensure the documentation is updated to reflect this change. - Reason this comment was not posted:
Comment did not seem useful.
3. instructor/patch.py:43
- Draft comment:
Themax_retries
parameter has been updated to acceptint | Retrying | AsyncRetrying
in multiple functions. Ensure the tests are updated to reflect this change. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_aijkg4LNjdfPE93L
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
@jxnl I am aware that this may be far too simplistic of an approach. from I am just trying to fix the need for a Cheers! |
Modifying the typehints since AsyncRetrying is really only for async clients so we should be selective about the typing here Link : https://python.useinstructor.com/concepts/retrying/#other-features-of-tenacity |
@ivanleomk ahh I missed this, thanks a lot. Appreciate the commits and review |
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.
CI is good to go, going to approve this. Thanks for helping to fix the typing.
No worries at all. Thanks for the approval! |
When working on a project and reviewing the docs I noticed that there were
# type: ignore
references when using atenacity
Retrying | AsyncRetrying
object.This PR aims to fix the underlying
type issues
as it seemsmax_retries
can always be one of:int | Retrying | AsyncRetrying
Important
Fix
max_retries
typing to acceptint
,Retrying
, orAsyncRetrying
inclient.py
andpatch.py
.max_retries
parameter type toint | Retrying | AsyncRetrying
increate
,create_partial
,create_iterable
, andcreate_with_completion
functions inclient.py
.max_retries
parameter type toint | Retrying | AsyncRetrying
innew_create_async
andnew_create_sync
functions inpatch.py
.Retrying
andAsyncRetrying
imports fromtenacity
inclient.py
andpatch.py
.This description was created by for fce914c. It will automatically update as commits are pushed.