As checked from the code, we have 2 retry logics for retrying 429 errors:
File: oairequester.py
Class: OAIRequester
Function: _call
& Currently both these two retry logics are coupled together.
This violates Separation of Concerns principle.
Also, not sure if the end user would always want that - i.e. multiple retries for the same request from two different logics.
For example, If Backoff strategy is specified by the user, then the same 429 request which was retried in previous code snippet based on RETRY_AFTER_MS_HEADER will again be retried. multiple times again!
Solution Suggestion
It would be a good idea that (just like backoff) to also parametrize the retry logic from command line arguments.
So that the end user could then accordingly adjust the behavior of retries as per their requirement.
As checked from the code, we have 2 retry logics for retrying 429 errors:
File: oairequester.py
Class: OAIRequester
Function: _call
& Currently both these two retry logics are coupled together.
This violates Separation of Concerns principle.
Also, not sure if the end user would always want that - i.e. multiple retries for the same request from two different logics.
For example, If Backoff strategy is specified by the user, then the same 429 request which was retried in previous code snippet based on RETRY_AFTER_MS_HEADER will again be retried. multiple times again!
Solution Suggestion
It would be a good idea that (just like backoff) to also parametrize the retry logic from command line arguments.
So that the end user could then accordingly adjust the behavior of retries as per their requirement.