Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bagatur/runnable with fallbacks #8543

Merged
merged 12 commits into from
Aug 4, 2023
Merged

Conversation

baskaryan
Copy link
Collaborator

No description provided.

@vercel
Copy link

vercel bot commented Jul 31, 2023

The latest updates on your projects. Learn more about Vercel for Git 鈫楋笌

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain 猬滐笍 Ignored (Inspect) Visit Preview Aug 3, 2023 4:42pm

@dosubot dosubot bot added the 馃:improvement Medium size change to existing code to handle new use-cases label Jul 31, 2023
@baskaryan baskaryan marked this pull request as ready for review August 1, 2023 16:50
Copy link
Collaborator

@eyurtsev eyurtsev left a 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

class RunnableWithFallbacks(Serializable, Runnable[Input, Output]):
runnable: Runnable[Input, Output]
fallbacks: Sequence[Runnable[Input, Output]]
exceptions_to_handle: Tuple[Type[BaseException]] = (Exception,)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this into a required variable instead of allowing broad exceptions by default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't feel super strongly but imagine at least some folks just want some LLM to work and want to fallback on any error

libs/langchain/langchain/schema/runnable.py Outdated Show resolved Hide resolved
libs/langchain/langchain/schema/runnable.py Outdated Show resolved Hide resolved
libs/langchain/langchain/schema/runnable.py Show resolved Hide resolved
libs/langchain/tests/unit_tests/schema/test_runnable.py Outdated Show resolved Hide resolved
@baskaryan baskaryan merged commit f437311 into master Aug 4, 2023
23 checks passed
@baskaryan baskaryan deleted the bagatur/runnable_with_fallbacks branch August 4, 2023 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃:improvement Medium size change to existing code to handle new use-cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants