-
Notifications
You must be signed in to change notification settings - Fork 738
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
Add FallbackModel
support
#894
Conversation
Co-authored-by: Alex Hall <[email protected]>
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 looks great. Let's confirm the new exception names with Samuel tomorrow morning then merge.
Thanks @dmontagu for picking up the rest of the changes here :) |
This PR is mine now. |
Docs Preview
|
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.
- We should be able to pass a callable that determines if we should fallback to the next model, or a tuple of exception types.
- We need to subclass
ExceptionGroup
.
ba592e2
to
f5d2a5c
Compare
This PR adds a
FallbackModel
to themodels
folder that allows for delegation of a task to a new model if the current model fails with a 4xx or 5xx response. See the docs for a detailed example.Easiest to review by toggling the "hide whitespace" button.
Fix #516
This is one of the items on our roadmap as well.
In a follow up PR:
ModelStatusError
and rethink our error structure internally (before the next release)