-
Notifications
You must be signed in to change notification settings - Fork 5
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
added retry when sending httpx request to LLM provider apis #20
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lifeizhou-ap
changed the title
added retry_with_backoff decorator
added retry when sending httpx request to LLM provider apis
Aug 30, 2024
michaelneale
approved these changes
Aug 30, 2024
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.
I like this a lot - would like some other eyes on this very sensitive part of the code.
salman1993
reviewed
Aug 30, 2024
zakiali
reviewed
Aug 30, 2024
zakiali
reviewed
Aug 30, 2024
zakiali
reviewed
Aug 30, 2024
andrewblane
reviewed
Aug 30, 2024
andrewblane
reviewed
Aug 30, 2024
lukealvoeiro
approved these changes
Aug 30, 2024
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, pending one nit.
Co-authored-by: Luke Alvoeiro <[email protected]>
lukealvoeiro
pushed a commit
that referenced
this pull request
Sep 2, 2024
Co-authored-by: Andy Lane <[email protected]> Co-authored-by: Luke Alvoeiro <[email protected]>
lukealvoeiro
added a commit
that referenced
this pull request
Sep 2, 2024
* main: fix typos found by PyCharm (#21) added retry when sending httpx request to LLM provider apis (#20) chore: version bump to `0.8.2` (#19) fix: don't always use ollama provider (#18) fix: export `metadata.plugins` export should have a valid value (#17) Create an entry-point for `ai-exchange` (#16) chore: Run tests for python >=3.10 (#14) Update pypi_release.yaml (#13) ollama provider (#7) chore: gitignore generated lockfile (#8)
codefromthecrypt
pushed a commit
to codefromthecrypt/exchange
that referenced
this pull request
Oct 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
Implement retry when request to LLM provider API returns certain response code. Currently it is implemented in the
anthropic
provider. we would like to enable retry for other providersWhat
retry_with_backoff
decorator. This is a generic decoratorretry_httpx_request
decorator which is specific for sending httpx request to the LLM provider api. It can specify the response status codes which requires retry. The retry logic is built based onanthropic
providerretry_httpx_request
to all the providers with default behavioursNote/Todo
I was not involved in the initial discussion. So I created two decorators that people can choose. Personally I think
retry_httpx_request
is sufficient for our use cases. Ifretry_with_backoff
is not required, please delete itI've applied the
retry_httpx_request
to all the providers in this project with default values. You may add the customised parameter value on the decorator if the default value does not suit for some providers.