added retry when sending httpx request to LLM provider apis#20
Merged
andrewblane merged 11 commits intomainfrom Aug 30, 2024
Merged
added retry when sending httpx request to LLM provider apis#20andrewblane merged 11 commits intomainfrom
andrewblane merged 11 commits intomainfrom
Conversation
michaelneale
approved these changes
Aug 30, 2024
Collaborator
michaelneale
left a comment
There was a problem hiding this comment.
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
Collaborator
lukealvoeiro
left a comment
There was a problem hiding this comment.
LGTM, pending one nit.
Co-authored-by: Luke Alvoeiro <lalvoeiro@squareup.com>
lukealvoeiro
pushed a commit
that referenced
this pull request
Sep 2, 2024
Co-authored-by: Andy Lane <alane@squareup.com> Co-authored-by: Luke Alvoeiro <lalvoeiro@squareup.com>
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
This file contains hidden or 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
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
anthropicprovider. we would like to enable retry for other providersWhat
retry_with_backoffdecorator. This is a generic decoratorretry_httpx_requestdecorator 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 onanthropicproviderretry_httpx_requestto 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_requestis sufficient for our use cases. Ifretry_with_backoffis not required, please delete itI've applied the
retry_httpx_requestto 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.